File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -205,3 +205,16 @@ describe('fetchAndRegisterLocaleData', () => {
205205 `Actually called with ${ fetchStub . args [ 0 ] [ 0 ] } ` ) ;
206206 } ) ;
207207} ) ;
208+
209+ describe ( 'supported locales without a remote base' , ( ) => {
210+ it ( 'offers only the bundled locales' , ( ) => {
211+ const locales = i18n . i18n . getAllSupportedDevToolsLocales ( ) ;
212+ assert . includeMembers ( locales , [ 'en-US' , 'zh' ] ) ;
213+ assert . notInclude ( locales , 'it' ) ;
214+ } ) ;
215+
216+ it ( 'resolves an unbundled locale to en-US' , ( ) => {
217+ assert . strictEqual ( i18n . i18n . lookupClosestSupportedDevToolsLocale ( 'it-IT' ) , 'en-US' ) ;
218+ assert . strictEqual ( i18n . i18n . lookupClosestSupportedDevToolsLocale ( 'zh-CN' ) , 'zh' ) ;
219+ } ) ;
220+ } ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ import {
1616 REMOTE_FETCH_PATTERN ,
1717} from './locales.js' ;
1818
19- const i18nInstance = new I18n . I18n . I18n ( LOCALES , DEFAULT_LOCALE ) ;
19+ // [RN] React Native ships only the bundled locales and has no remoteBase to fetch
20+ // the rest from, so offer and resolve to the bundled locales only.
21+ const i18nInstance = new I18n . I18n . I18n (
22+ Root . Runtime . getRemoteBase ( ) ?. version ? LOCALES : BUNDLED_LOCALES_GENERATED , DEFAULT_LOCALE ) ;
2023
2124// All the locales that are part of the DevTools bundle and should not be fetched
2225// remotely.
You can’t perform that action at this time.
0 commit comments