Russian language support (#9406)
Co-authored-by: Jack Amadeo <jackamadeo@squareup.com>
This commit is contained in:
@@ -52,6 +52,16 @@ describe('getLocale', () => {
|
|||||||
expect(getLocale()).toEqual({ locale: 'en-GB', messageLocale: 'en' });
|
expect(getLocale()).toEqual({ locale: 'en-GB', messageLocale: 'en' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns Russian when navigator.languages contains ru', () => {
|
||||||
|
vi.stubGlobal('navigator', { languages: ['ru'] });
|
||||||
|
expect(getLocale()).toEqual({ locale: 'ru', messageLocale: 'ru' });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('preserves Russian regional tag for formatting', () => {
|
||||||
|
vi.stubGlobal('navigator', { languages: ['ru-RU'] });
|
||||||
|
expect(getLocale()).toEqual({ locale: 'ru-RU', messageLocale: 'ru' });
|
||||||
|
});
|
||||||
|
|
||||||
it('supports Turkish from navigator.languages', () => {
|
it('supports Turkish from navigator.languages', () => {
|
||||||
vi.stubGlobal('navigator', { languages: ['tr-TR'] });
|
vi.stubGlobal('navigator', { languages: ['tr-TR'] });
|
||||||
expect(getLocale()).toEqual({ locale: 'tr-TR', messageLocale: 'tr' });
|
expect(getLocale()).toEqual({ locale: 'tr-TR', messageLocale: 'tr' });
|
||||||
|
|||||||
@@ -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', 'tr', 'zh-CN']);
|
const SUPPORTED_LOCALES = new Set(['en', 'ru', '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