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 @@ -244,10 +244,14 @@ export function useCmsInfoState() {
244244
245245 // If l10nEnabled is false, only fetch for English locales
246246 // Check both browser language and user's selected locale
247- const isEnglishBrowser = navigator . language . startsWith ( 'en' ) ;
248- const isEnglishSelected = currentLocale . startsWith ( 'en' ) ;
247+ let isEnglish = false ;
248+ if ( currentLocale ) {
249+ isEnglish = currentLocale . startsWith ( 'en' ) ;
250+ } else if ( navigator . language ) {
251+ isEnglish = navigator . language . startsWith ( 'en' ) ;
252+ }
249253
250- return isEnglishBrowser || isEnglishSelected ;
254+ return isEnglish ;
251255 }
252256
253257 if (
You can’t perform that action at this time.
0 commit comments