@procore/core-react
Version:
React library of Procore Design Guidelines
39 lines (38 loc) • 1.82 kB
JavaScript
// All and only locales that will receive Smartling translations and can be directly fed into <I18nProvider>
/**
* @deprecated you can use TMS_SUPPORTED_LOCALE from [Globalization toolkit](https://github.com/procore/globalization-toolkit)
* @deprecatedSince 12.10.0
*/
// TODO breaking change requiring a new minimum version of the peerDep, replace with GTK imports
var SUPPORTED_LOCALES = ['de-DE', 'en-AU', 'en-CA', 'en-GB', 'en', 'es-ES', 'es', 'fr-CA', 'fr-FR', 'is-IS', 'ja-JP', 'pl-PL', 'pseudo', 'pt-BR', 'th-TH', 'zh-SG', 'zh-TW', 'it-IT', 'pt-PT', 'nb-NO'];
/*
all locales that should directly use a different locale. Any other unsupported locale will fallback to 'en'
this should match https://github.com/procore/procore/blob/d0515461046b8d018c8fa8ede1ca8b7aa2fcacf8/config/application.rb#L234C1-L240C7
for any locales that are not listed in SUPPORTED_LOCALES
*/
/**
* @deprecated you can use OVERWRITE_LOCALE_MAP from [Globalization toolkit](https://github.com/procore/globalization-toolkit)
* @deprecatedSince 12.10.0
*/
export var OVERWRITE_LOCALE_MAP = {
'en-AE': 'en-GB',
'en-SG': 'en-GB',
'es-419': 'es'
};
/**
* @deprecatedSince 12.10.0
* @deprecated you can use getOverrideLocale from [Globalization toolkit](https://procore.github.io/globalization-toolkit/#md:getoverridelocale-function)
* Returns the locale that should be used for the I18nProvider based on the environment locale
* @param envLocale - the locale from the environment
* @returns the locale that should be used for the I18nProvider
*/
export function getI18nProviderLocale(envLocale) {
if (SUPPORTED_LOCALES.includes(envLocale)) {
return envLocale;
}
if (OVERWRITE_LOCALE_MAP[envLocale]) {
return OVERWRITE_LOCALE_MAP[envLocale];
}
return 'en';
}
//# sourceMappingURL=getI18nProviderLocale.js.map