i18n: sort languages by name, not by locale code (#2625)
### Change Type - [x] `patch` — Bug fix ### Release Notes - Sorts the locale list by locale name, not code.
This commit is contained in:
parent
d6e9912d92
commit
4aaeafd916
4 changed files with 55 additions and 52 deletions
|
@ -215,9 +215,12 @@ async function copyTranslations() {
|
|||
// languages.ts
|
||||
|
||||
const languagesSource = await readJsonIfExists(join(sourceFolderPath, 'languages.json'))!
|
||||
type Language = { label: string; locale: string }
|
||||
const languagesFile = `
|
||||
/** @public */
|
||||
export const LANGUAGES = ${JSON.stringify(languagesSource)} as const
|
||||
export const LANGUAGES = ${JSON.stringify(
|
||||
languagesSource.sort((a: Language, b: Language) => a.label.localeCompare(b.label))
|
||||
)} as const
|
||||
`
|
||||
const schemaPath = join(REPO_ROOT, 'packages', 'tlschema', 'src', 'translations')
|
||||
const schemaLanguagesFilePath = join(schemaPath, 'languages.ts')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue