async getTokens(srcInput) { const input = srcInput; if (!input.tokens && input.sentimentDictionary.type) { input.tokens = await this.prepare( input.locale, input.utterance || input.text, input.settings ); } return input; }
run(srcInput) { const input = srcInput; const locale = input.locale || 'en'; const extractor = this.container.get(`extract-trim-${locale}`) || this; return extractor.extract(input); }
UNSAFE_componentWillReceiveProps( nextProps ) { if ( nextProps.step && 'invalid' === nextProps.step.status ) { this.setState( { submitting: false } ); } if ( this.props.flowName !== nextProps.flowName || this.props.locale !== nextProps.locale || this.props.subHeaderText !== nextProps.subHeaderText ) { this.setSubHeaderText( nextProps ); } }
function translationStatusToMdTable(status) { const output = []; output.push([' ', 'Language', 'Po File', 'Last translator', 'Percent done'].join(' | ')); output.push(['---', '---', '---', '---', '---'].join('|')); for (let i = 0; i < status.length; i++) { const stat = status[i]; const flagUrl = flagImageUrl(stat.locale); output.push([`![](${flagUrl})`, stat.languageName, `[${stat.locale}](${poFileUrl(stat.locale)})`, stat.translatorName, `${stat.percentDone}%`].join(' | ')); } return output.join('\n'); }
props.months.map(month => ( <option value={month}> {dayjs() .set('month', month - 1) .locale(props.newUser.language) .format('MMMM')} </option> ))
function formatDate (value, args = {}) { if (Object.keys(args).length) { const { format, locale = 'en' } = args return moment .utc(toString(value), ISO_8601_FORMAT, true) .locale(locale) .format(format) } return toString(value) }
run(srcInput, settings) { return this.find( srcInput.locale, srcInput.intent, srcInput.context, settings ); }
// redirect the user to the next step scrollPromise.then( () => { if ( ! this.isEveryStepSubmitted() ) { page( getStepUrl( flowName, stepName, stepSectionName, this.props.locale ) ); } else if ( this.isEveryStepSubmitted() ) { this.goToFirstInvalidStep(); } } );
decideRules(srcInput) { const input = srcInput; input.nerRules = this.getRules(input.locale || 'en'); return input; }
async run(srcInput) { const input = srcInput; const locale = input.locale || 'en'; const stemmer = this.container.get(`stemmer-${locale}`) || this; input.tokens = await stemmer.stem( input.text || input.tokens.join(' '), input ); return input; }
function languageProviderReducer(state = initialState, action) { switch (action.type) { case CHANGE_LOCALE: // Set user language in local storage. window.localStorage.setItem(localStorageKey, action.locale); strapi.currentLanguage = action.locale; return state.set('locale', action.locale); default: return state; } }
run(srcInput) { const input = srcInput; const locale = input.locale || 'en'; const normalizer = this.container.get(`normalizer-${locale}`) || this; input.text = normalizer.normalize(input.text, input); return input; }
function formatDate (value, args = {}) { if (Object.keys(args).length) { const { format, locale = 'en' } = args return moment .utc(toString(value), ISO_8601_FORMAT, true) .locale(locale) .format(format) } return toString(value) }
props.months.map(month => ( <option value={month}> {dayjs() .set('month', month - 1) .locale(props.newUser.language) .format('MMMM')} </option> ))