Add Turkish desktop locale (#9392)
Signed-off-by: dejavu <dejavu@Mac.home> Co-authored-by: dejavu <dejavu@Mac.home>
This commit is contained in:
@@ -52,6 +52,17 @@ describe('getLocale', () => {
|
|||||||
expect(getLocale()).toEqual({ locale: 'en-GB', messageLocale: 'en' });
|
expect(getLocale()).toEqual({ locale: 'en-GB', messageLocale: 'en' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('supports Turkish from navigator.languages', () => {
|
||||||
|
vi.stubGlobal('navigator', { languages: ['tr-TR'] });
|
||||||
|
expect(getLocale()).toEqual({ locale: 'tr-TR', messageLocale: 'tr' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('supports explicit Turkish locale', () => {
|
||||||
|
mockAppConfig({ GOOSE_LOCALE: 'tr' });
|
||||||
|
vi.stubGlobal('navigator', { languages: ['xx-XX'] });
|
||||||
|
expect(getLocale()).toEqual({ locale: 'tr', messageLocale: 'tr' });
|
||||||
|
});
|
||||||
|
|
||||||
it('falls back to base language when locale tag is invalid BCP 47', () => {
|
it('falls back to base language when locale tag is invalid BCP 47', () => {
|
||||||
// "en-" is not a valid BCP 47 tag and would cause RangeError in Intl APIs
|
// "en-" is not a valid BCP 47 tag and would cause RangeError in Intl APIs
|
||||||
mockAppConfig({ GOOSE_LOCALE: 'en-' });
|
mockAppConfig({ GOOSE_LOCALE: 'en-' });
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
export { defineMessages, useIntl } from 'react-intl';
|
export { defineMessages, useIntl } from 'react-intl';
|
||||||
|
|
||||||
/** The set of locales that have translation catalogs. */
|
/** The set of locales that have translation catalogs. */
|
||||||
const SUPPORTED_LOCALES = new Set(['en', 'zh-CN']);
|
const SUPPORTED_LOCALES = new Set(['en', 'tr', 'zh-CN']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map Simplified Chinese aliases (zh, zh-Hans*, zh-SG, zh-MY) to "zh-CN".
|
* Map Simplified Chinese aliases (zh, zh-Hans*, zh-SG, zh-MY) to "zh-CN".
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user