react-intl#addLocaleData JavaScript Examples

The following examples show how to use react-intl#addLocaleData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: languageSetup.js    From Edlib with GNU General Public License v3.0 6 votes vote down vote up
addLanguage = (languageCode) => {
    let i18nData;
    try {
        switch (languageCode) {
            case 'no':
                //No break;
            case 'nb':
                //No break;
            case 'nb-no':
                i18nData = i18nDataNbNo;
                addLocaleData(localeNb);
                break;
            case 'sv-se':
                i18nData = i18nDataSvSe;
                addLocaleData(localeSv);
                break;
            default:
                i18nData = i18nDataEnGb;
                addLocaleData(localeEn);
                break;
        }
    } catch (ex) {
        // Ignore and use the default language
    }
    if (typeof i18nData === 'undefined' || i18nData === null) {
        i18nData = i18nDataEnGb;
        addLocaleData(localeEn);
    }
    return i18nData.default;
}
Example #2
Source File: index.js    From Nemesis with GNU General Public License v3.0 6 votes vote down vote up
addLocaleData([
  ...locale_en,
  ...locale_de,
  ...locale_es,
  ...locale_fr,
  ...locale_it,
  ...locale_ko,
  ...locale_pl,
  ...locale_ru,
  ...locale_sr
]);
Example #3
Source File: IntlProvider.js    From covid19-testing with Apache License 2.0 6 votes vote down vote up
export function SpanishIntlProvider(props: Props) {
  // Not ideal that these side effect functions (polyfillIntl, addLocaleData)
  // are happening directly in the render, since render will be executed many
  // times. Hesitant to change that behavior right now without understanding
  // intl/react-intl more deeply.
  polyfillIntl(props.userLanguage);

  let intlMessages;
  if (props.userLanguage === 'es') {
    intlMessages = spanishMessages;
    addLocaleData(localDataEs);
  }

  const locale = LanguageToLocale[props.userLanguage];
  return (
    <IntlProvider defaultLocale="en-US" locale={locale} messages={intlMessages}>
      <IntlProviderNewContextAdapter>{props.children}</IntlProviderNewContextAdapter>
    </IntlProvider>
  );
}
Example #4
Source File: index.js    From IBM-db2-blockchain-insurance-application with Apache License 2.0 5 votes vote down vote up
addLocaleData([...enLocaleData, ...deLocaleData]);
Example #5
Source File: index.js    From IBM-db2-blockchain-insurance-application with Apache License 2.0 5 votes vote down vote up
addLocaleData([...deLocaleData, ...enLocaleData]);
Example #6
Source File: index.js    From IBM-db2-blockchain-insurance-application with Apache License 2.0 5 votes vote down vote up
addLocaleData([...deLocaleData, ...enLocaleData]);
Example #7
Source File: index.js    From IBM-db2-blockchain-insurance-application with Apache License 2.0 5 votes vote down vote up
addLocaleData([...deLocaleData, ...enLocaleData]);
Example #8
Source File: index.js    From IBM-db2-blockchain-insurance-application with Apache License 2.0 5 votes vote down vote up
addLocaleData([...deLocaleData, ...enLocaleData]);
Example #9
Source File: index.js    From ice-electron with MIT License 5 votes vote down vote up
// 设置语言包
addLocaleData([...en, ...zh]);