Website (14 monoliths split): - compliance/page.tsx (1,519 → 9), docs/audit (1,262 → 20) - quality (1,231 → 16), alerts (1,203 → 10), docs (1,202 → 11) - i18n.ts (1,173 → 8 language files) - unity-bridge (1,094 → 12), backlog (1,087 → 6) - training (1,066 → 8), rag (1,063 → 8) - Deleted index_original.ts (4,899 LOC dead backup) Studio-v2 (5 monoliths split): - meet/page.tsx (1,481 → 9), messages (1,166 → 9) - AlertsB2BContext.tsx (1,165 → 5 modules) - alerts-b2b/page.tsx (1,019 → 6), korrektur/archiv (1,001 → 6) All existing imports preserved. Zero new TypeScript errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
/**
|
|
* Internationalization (i18n) System
|
|
*
|
|
* Unterstuetzt dieselben 7 Sprachen wie das Studio Frontend:
|
|
* de, en, tr, ar, ru, uk, pl
|
|
*
|
|
* Translations are split per language into separate files:
|
|
* i18n-de.ts, i18n-en.ts, i18n-tr.ts, i18n-ar.ts, i18n-ru.ts, i18n-uk.ts, i18n-pl.ts
|
|
*/
|
|
|
|
import { de } from './i18n-de'
|
|
import { en } from './i18n-en'
|
|
import { tr } from './i18n-tr'
|
|
import { ar } from './i18n-ar'
|
|
import { ru } from './i18n-ru'
|
|
import { uk } from './i18n-uk'
|
|
import { pl } from './i18n-pl'
|
|
|
|
export type Language = 'de' | 'en' | 'tr' | 'ar' | 'ru' | 'uk' | 'pl'
|
|
|
|
export const LANGUAGES: { code: Language; name: string; flag: string }[] = [
|
|
{ code: 'de', name: 'Deutsch', flag: '🇩🇪' },
|
|
{ code: 'en', name: 'English', flag: '🇬🇧' },
|
|
{ code: 'tr', name: 'Türkçe', flag: '🇹🇷' },
|
|
{ code: 'ar', name: 'العربية', flag: '🇸🇦' },
|
|
{ code: 'ru', name: 'Русский', flag: '🇷🇺' },
|
|
{ code: 'uk', name: 'Українська', flag: '🇺🇦' },
|
|
{ code: 'pl', name: 'Polski', flag: '🇵🇱' },
|
|
]
|
|
|
|
export const DEFAULT_LANGUAGE: Language = 'de'
|
|
|
|
// RTL Languages
|
|
export const RTL_LANGUAGES: Language[] = ['ar']
|
|
|
|
export function isRTL(lang: Language): boolean {
|
|
return RTL_LANGUAGES.includes(lang)
|
|
}
|
|
|
|
// Translations assembled from per-language modules
|
|
export const translations: Record<Language, Record<string, string>> = {
|
|
de,
|
|
en,
|
|
tr,
|
|
ar,
|
|
ru,
|
|
uk,
|
|
pl,
|
|
}
|
|
|
|
/**
|
|
* Get translation for key
|
|
*/
|
|
export function t(key: string, lang: Language = DEFAULT_LANGUAGE): string {
|
|
return translations[lang]?.[key] || translations[DEFAULT_LANGUAGE]?.[key] || key
|
|
}
|
|
|
|
/**
|
|
* Get all translations for a language
|
|
*/
|
|
export function getTranslations(lang: Language): Record<string, string> {
|
|
return translations[lang] || translations[DEFAULT_LANGUAGE]
|
|
}
|