File tree Expand file tree Collapse file tree
packages/fxa-settings/src/models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -410,12 +410,12 @@ describe('useCmsInfoState', () => {
410410 } ) ;
411411
412412 it ( 'should fetch when l10nEnabled is false but browser language is English' , async ( ) => {
413- // Mock English browser language but non- English selected locale
413+ // Mock English browser language and English selected locale
414414 Object . defineProperty ( navigator , 'language' , {
415415 writable : true ,
416416 value : 'en-GB' ,
417417 } ) ;
418- require ( '../contexts/DynamicLocalizationContext' ) . useDynamicLocalization . mockReturnValue ( { currentLocale : 'fr-FR ' } ) ;
418+ require ( '../contexts/DynamicLocalizationContext' ) . useDynamicLocalization . mockReturnValue ( { currentLocale : 'en-US ' } ) ;
419419
420420 mockUrlQueryData . get . mockImplementation ( ( key : string ) => {
421421 if ( key === 'client_id' ) return '1234567890abcdef' ;
Original file line number Diff line number Diff line change @@ -252,10 +252,14 @@ export function useCmsInfoState() {
252252
253253 // If l10nEnabled is false, only fetch for English locales
254254 // Check both browser language and user's selected locale
255- const isEnglishBrowser = navigator . language . startsWith ( 'en' ) ;
256- const isEnglishSelected = currentLocale . startsWith ( 'en' ) ;
255+ let isEnglish = false ;
256+ if ( currentLocale ) {
257+ isEnglish = currentLocale . startsWith ( 'en' ) ;
258+ } else if ( navigator . language ) {
259+ isEnglish = navigator . language . startsWith ( 'en' ) ;
260+ }
257261
258- return isEnglishBrowser || isEnglishSelected ;
262+ return isEnglish ;
259263 }
260264
261265 if (
You can’t perform that action at this time.
0 commit comments