Skip to content

Build intl files#367

Open
bearfriend wants to merge 15 commits into
mainfrom
dgleckler/new-locales
Open

Build intl files#367
bearfriend wants to merge 15 commits into
mainfrom
dgleckler/new-locales

Conversation

@bearfriend
Copy link
Copy Markdown
Contributor

@bearfriend bearfriend commented May 14, 2026

GAUD-9823: Build (current) intl locale files

Builds the existing common.js locale data dynamically and moves it to locale-data/supported.js

@bearfriend bearfriend requested a review from a team as a code owner May 14, 2026 16:17
Comment thread build-locale-data/build-intl-files.js Outdated
Comment thread build-locale-data/generate-locale-data.js Outdated
Comment thread lib/common.js
{ id: 20, code: 'zh-tw', pack: 'zh-tw', overrideCode: 'zh-Hant', dir: 'ltr', name: '中文(繁体)' }
];
export const supportedLocales = supportedLocalesDetails.map((l) => l.code);
export { defaultLocale, supportedBaseLocales, supportedLangpacks, supportedLocalesDetails, supportedLocales };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Comment thread lib/common.js
export const supportedLocales = supportedLocalesDetails.map((l) => l.code);
export { defaultLocale, supportedBaseLocales, supportedLangpacks, supportedLocalesDetails, supportedLocales };

function tryResolve(langTag) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a bunch of duplication of what this is doing around. I've created a story to look into it separately.

GAUD-10029: Investigate duplication of locale tag parsing code

Comment on lines +1 to +31
export const defaultLocale = 'en';
export const supportedBaseLocales = ['ar', 'ca', 'cy', 'da', 'de', 'en', 'es', 'fr', 'haw', 'hi', 'ja', 'ko', 'mi', 'nl', 'pt', 'sv', 'th', 'tr', 'vi', 'zh'];
export const supportedLangpacks = ['ar', 'ca', 'cy', 'da', 'de', 'en-gb', 'en', 'es-es', 'es', 'fr-fr', 'fr-on', 'fr', 'haw', 'hi', 'ja', 'ko', 'mi', 'nl', 'pt', 'sv', 'th', 'tr', 'vi', 'zh-cn', 'zh-tw'];
export const supportedLocalesDetails = [
{ id: 16, code: 'ar-sa', source: 'ar', pack: 'ar', dir: 'rtl', name: 'العربية' },
{ id: 38, code: 'ca-es', source: 'ca', pack: 'ca', dir: 'ltr', name: 'Català (Espanya)' },
{ id: 31, code: 'cy-gb', source: 'cy', pack: 'cy', dir: 'ltr', name: 'Cymraeg (Y Deyrnas Unedig)' },
{ id: 28, code: 'da-dk', source: 'da', pack: 'da', dir: 'ltr', name: 'Dansk (danmark)' },
{ id: 26, code: 'de-de', source: 'de', pack: 'de', dir: 'ltr', name: 'Deutsch (Deutschland)' },
{ id: 13, code: 'en-ca', source: 'en-CA', dir: 'ltr', name: 'English (Canada)' },
{ id: 11, code: 'en-gb', source: 'en-GB', pack: 'en-gb', dir: 'ltr', name: 'English (United Kingdom)' },
{ id: 1, code: 'en-us', source: 'en', pack: 'en', dir: 'ltr', name: 'English (United States)' },
{ id: 30, code: 'es-es', source: 'es', pack: 'es-es', dir: 'ltr', name: 'Español (España)' },
{ id: 18, code: 'es-mx', source: 'es-MX', pack: 'es', overrideCode: 'es-419', dir: 'ltr', name: 'Español (Latinoamérica)' },
{ id: 2, code: 'fr-ca', source: 'fr-CA', pack: 'fr', dir: 'ltr', name: 'Français (Canada)' },
{ id: 29, code: 'fr-fr', source: 'fr', pack: 'fr-fr', dir: 'ltr', name: 'Français (France)' },
{ id: 32, code: 'fr-on', source: 'fr-CA', pack: 'fr-on', overrideCode: 'fr-CA-Ontario', dir: 'ltr', name: 'Français (Ontario)' },
{ id: 35, code: 'haw-us', source: 'haw', pack: 'haw', dir: 'ltr', name: 'ʻŌlelo Hawaiʻi (ʻAmelika Hui Pū ʻIa)' },
{ id: 33, code: 'hi-in', source: 'hi', pack: 'hi', dir: 'ltr', name: 'हिंदी (भारत)' },
{ id: 21, code: 'ja-jp', source: 'ja', pack: 'ja', dir: 'ltr', name: '日本語 (日本)' },
{ id: 22, code: 'ko-kr', source: 'ko', pack: 'ko', dir: 'ltr', name: '한국어 (대한민국)' },
{ id: 34, code: 'mi-nz', source: 'mi', pack: 'mi', dir: 'ltr', name: 'Māori (Aotearoa)' },
{ id: 25, code: 'nl-nl', source: 'nl', pack: 'nl', dir: 'ltr', name: 'Nederlands (Nederland)' },
{ id: 19, code: 'pt-br', source: 'pt', pack: 'pt', dir: 'ltr', name: 'Português (Brasil)' },
{ id: 24, code: 'sv-se', source: 'sv', pack: 'sv', dir: 'ltr', name: 'Svenska (Sverige)' },
{ id: 37, code: 'th-th', source: 'th', pack: 'th', dir: 'ltr', name: 'ไทย (ไทย)' },
{ id: 23, code: 'tr-tr', source: 'tr', pack: 'tr', dir: 'ltr', name: 'Türkçe (Türkiye)' },
{ id: 36, code: 'vi-vn', source: 'vi', pack: 'vi', dir: 'ltr', name: 'Tiếng Việt (Việt Nam)' },
{ id: 17, code: 'zh-cn', source: 'zh', pack: 'zh-cn', overrideCode: 'zh-Hans', dir: 'ltr', name: '中文(简体)' },
{ id: 20, code: 'zh-tw', source: 'zh-Hant', pack: 'zh-tw', overrideCode: 'zh-Hant', dir: 'ltr', name: '中文(繁体)' },
];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference between this and the old common data is the addition of source and some sorting

Image

@bearfriend bearfriend force-pushed the dgleckler/new-locales branch from 3e7d52c to a848715 Compare May 14, 2026 22:12
@bearfriend bearfriend requested a review from dlockhart May 20, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants