chore: language order (#370)
This commit is contained in:
@@ -83,8 +83,10 @@ Support team development by adding or removing members from projects. You can as
|
||||
|
||||
UnitTCMS currently supports the following languages:
|
||||
|
||||
- German (de)
|
||||
- English (en)
|
||||
- Japanese (ja)
|
||||
- Portuguese (pt-BR)
|
||||
- Chinese (zh-CN)
|
||||
- Japanese (ja)
|
||||
|
||||
If you would like to add support for another language, feel free to submit a pull request. For reference, you can see how Portuguese was added in [PR #260](https://github.com/kimatata/unittcms/pull/260).
|
||||
|
||||
@@ -9,12 +9,17 @@ const memberRoles: MemberRoleType[] = [{ uid: 'manager' }, { uid: 'developer' },
|
||||
|
||||
const categoricalPalette = ['#fba91e', '#6ea56c', '#3ac6e1', '#feda2f', '#f15f47', '#244470', '#9c80bb', '#f595a6'];
|
||||
|
||||
/**
|
||||
* Locales are grouped by script: Latin-based locales first, followed by CJK.
|
||||
* Within Latin-based group, entries are sorted lexicographically by their BCP 47 codes.
|
||||
* This matches common UI patterns.
|
||||
*/
|
||||
const locales: LocaleType[] = [
|
||||
{ code: 'en', name: 'English' },
|
||||
{ code: 'ja', name: '日本語' },
|
||||
{ code: 'de', name: 'Deutsch' },
|
||||
{ code: 'en', name: 'English' },
|
||||
{ code: 'pt-BR', name: 'Português' },
|
||||
{ code: 'zh-CN', name: '简体中文' },
|
||||
{ code: 'ja', name: '日本語' },
|
||||
];
|
||||
|
||||
// The status of each test run
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import de from './de.json';
|
||||
import en from './en.json';
|
||||
import ja from './ja.json';
|
||||
import ptBR from './pt-BR.json';
|
||||
import zhCN from './zh-CN.json';
|
||||
import de from './de.json';
|
||||
import ja from './ja.json';
|
||||
|
||||
function getAllKeys(obj: unknown, prefix = ''): string[] {
|
||||
if (typeof obj !== 'object' || obj === null) return [];
|
||||
@@ -18,14 +18,15 @@ function getAllKeys(obj: unknown, prefix = ''): string[] {
|
||||
|
||||
describe('Locale message keys consistency', () => {
|
||||
const locales = [
|
||||
{ name: 'de', data: de },
|
||||
{ name: 'en', data: en },
|
||||
{ name: 'ja', data: ja },
|
||||
{ name: 'pt-BR', data: ptBR },
|
||||
{ name: 'zh-CN', data: zhCN },
|
||||
{ name: 'de', data: de },
|
||||
{ name: 'ja', data: ja },
|
||||
];
|
||||
|
||||
const base = locales[0];
|
||||
const base = locales.find((locale) => locale.name === 'en');
|
||||
if (!base) throw new Error('Base locale not found');
|
||||
const baseKeys = getAllKeys(base.data);
|
||||
|
||||
for (const locale of locales.slice(1)) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { createNavigation } from 'next-intl/navigation';
|
||||
import { defineRouting } from 'next-intl/routing';
|
||||
|
||||
export const routing = defineRouting({
|
||||
locales: ['en', 'ja', 'pt-BR', 'zh-CN', 'de'],
|
||||
locales: ['de', 'en', 'pt-BR', 'zh-CN', 'ja'],
|
||||
defaultLocale: 'en',
|
||||
localePrefix: {
|
||||
mode: 'always',
|
||||
|
||||
@@ -4,5 +4,5 @@ import { routing } from './i18n/routing';
|
||||
export default createMiddleware(routing);
|
||||
|
||||
export const config = {
|
||||
matcher: ['/', '/(ja|en|pt-BR|zh-CN|de)/:path*'],
|
||||
matcher: ['/', '/(de|en|pt-BR|zh-CN|ja)/:path*'],
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type LocaleCodeType = 'en' | 'ja' | 'pt-BR' | 'zh-CN' | 'de';
|
||||
export type LocaleCodeType = 'de' | 'en' | 'pt-BR' | 'zh-CN' | 'ja';
|
||||
|
||||
export type LocaleType = {
|
||||
code: LocaleCodeType;
|
||||
|
||||
Reference in New Issue
Block a user