Skip to content

Commit

Permalink
Add a test to make sure locales are properly sorted by their native…
Browse files Browse the repository at this point in the history
… language name
  • Loading branch information
YummyBacon5 authored Nov 12, 2024
1 parent 1ad08fc commit bc8f024
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/app-client/src/locales/locales.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ describe('locales', () => {
expect(await fileExists(`./${key}.json`)).to.eql(true, `Missing file for locale ${key}`);
}
});

test('make sure locales are sorted by the native language name', () => {
const sortedLocales = [...locales].sort((a, b) => a.name.localeCompare(b.name));
expect(locales).to.eql(sortedLocales);
});
});
8 changes: 4 additions & 4 deletions packages/app-client/src/locales/locales.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Order of locales matters, keep it sorted by the native language name
export const locales = [
{ key: 'ar', name: 'العربية' },
{ key: 'zh-CN', name: '简体中文' },
{ key: 'de', name: 'Deutsch' },
{ key: 'en', name: 'English' },
{ key: 'es', name: 'Español' },
{ key: 'fr', name: 'Français' },
{ key: 'it', name: 'Italiano' },
{ key: 'hu', name: 'Magyar' },
{ key: 'nl', name: 'Nederlands' },
{ key: 'it', name: 'Italiano' },
{ key: 'pt', name: 'Português' },
{ key: 'pt-BR', name: 'Português (Brasil)' },
{ key: 'ru', name: 'Русский' },
{ key: 'vi', name: 'Tiếng Việt' },
{ key: 'ru', name: 'Русский' },
{ key: 'ar', name: 'العربية' },
{ key: 'zh-CN', name: '简体中文' },
] as const;

0 comments on commit bc8f024

Please sign in to comment.