From 58907a84649fac3a8b9f78e1648015c5f8b9c866 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 9 Sep 2024 14:25:49 +0100 Subject: [PATCH] i18n: Add test to check languages match a canonical locale (#93105) add test to check languages match a canonical locale --- public/app/core/internationalization/constants.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/app/core/internationalization/constants.test.ts b/public/app/core/internationalization/constants.test.ts index 8e50e6f34bf..6dee3878b36 100644 --- a/public/app/core/internationalization/constants.test.ts +++ b/public/app/core/internationalization/constants.test.ts @@ -25,6 +25,13 @@ describe('internationalization constants', () => { expect(DEFAULT_LANGUAGE).toBe(ENGLISH_US); }); + it('should match a canonical locale definition', () => { + for (const lang of LANGUAGES) { + const resolved = Intl.getCanonicalLocales(lang.code); + expect(lang.code).toEqual(resolved[0]); + } + }); + it('should not have duplicate languages codes', () => { const uniqLocales = uniqBy(LANGUAGES, (v) => v.code); expect(LANGUAGES).toHaveLength(uniqLocales.length);