Skip to content

Commit

Permalink
feat(phone-number): set locale fallback to english
Browse files Browse the repository at this point in the history
Signed-off-by: astagnol <[email protected]>
  • Loading branch information
astagnol authored and dpellier committed Oct 9, 2024
1 parent caf91ac commit 2a333fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function getCurrentLocale(locale?: OdsPhoneNumberLocale): OdsPhoneNumberLocale {

return getBrowserIsoCodes<ODS_PHONE_NUMBER_LOCALE>().find((browserIsoCode) => {
return ODS_PHONE_NUMBER_LOCALES.indexOf(browserIsoCode) >= 0;
}) || ODS_PHONE_NUMBER_LOCALE.fr;
}) || ODS_PHONE_NUMBER_LOCALE.en;
}

function getNationalPhoneNumberExample(isoCode: OdsPhoneNumberCountryIsoCode | undefined, phoneUtils: PhoneNumberUtil): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('ods-phone-number controller', () => {
global.navigator = { language: 'zh-gan' };

// @ts-ignore for test purpose
expect(getCurrentLocale('zw')).toBe('fr');
expect(getCurrentLocale('zw')).toBe('en');
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The locale (i.e. country list translation in <StorybookLink kind="ODS Components

If the given property is not defined or recognized, the component attempts to use the browser's locale settings.

If the browser's locale is also not recognized, the component defaults to French (FR).
If the browser's locale is also not recognized, the component defaults to English (EN).

<Heading label="ISO code" level={ 3 } />

Expand Down

0 comments on commit 2a333fc

Please sign in to comment.