feat(i18n): add Russian UI and harden localization

This commit is contained in:
Arthur Koba
2026-10-25 22:35:32 +03:00
parent 65a96670d5
commit b4e94076c9
115 changed files with 7767 additions and 993 deletions
+7 -5
View File
@@ -8,6 +8,7 @@ import { isLogStorageDisabledMessage } from '@/app/(main)/admin/logs/components/
import { searchItems } from '@/lib/utils/search-data';
import english from '@/messages/en.json';
import chinese from '@/messages/zh-CN.json';
import { locales } from './config';
import { getRuntimeTranslator } from './runtime';
afterEach(() => {
@@ -78,6 +79,7 @@ describe('imperative runtime translations', () => {
}
for (const message of [
'Edge edge-1 has invalid source',
'Ребро edge-1 ссылается на отсутствующий исходный узел other',
'边 ID edge-1 的端点无效',
]) {
expect(findGraphErrorTarget(new Error(message), [], ['edge-1'])).toEqual({
@@ -108,17 +110,17 @@ describe('imperative runtime translations', () => {
).toBe(true);
});
it('formats interpolated messages in both catalogs', () => {
for (const locale of ['en', 'zh-CN'] as const) {
it('formats interpolated messages in all catalogs', () => {
for (const locale of locales) {
const t = getRuntimeTranslator(locale);
for (const [key, text] of Object.entries(english.runtime)) {
if (/\{value\d+\}/.test(text)) {
if (/\{value\d+(?:\}|,)/.test(text)) {
const translated = t(key as keyof typeof english.runtime, {
value0: 'CUSTOM',
value0: 42,
value1: 'VALUE',
value2: 42,
});
expect(translated).toContain('CUSTOM');
expect(translated).toContain('42');
expect(translated).not.toContain('{value0}');
}
}