mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 23:01:48 +00:00
Add Turkish (tr) to client i18n and language registry
* feat(i18n): add Turkish language support and base tr translations Agent-Logs-Url: https://github.com/SkyLostTR/TREK/sessions/f86511d9-8ff1-4459-8ec1-879936135741 Co-authored-by: SkyLostTR <21984261+SkyLostTR@users.noreply.github.com> * test(i18n): update language list expectations for Turkish support
This commit is contained in:
@@ -6,6 +6,7 @@ import es from './translations/es'
|
|||||||
import fr from './translations/fr'
|
import fr from './translations/fr'
|
||||||
import hu from './translations/hu'
|
import hu from './translations/hu'
|
||||||
import it from './translations/it'
|
import it from './translations/it'
|
||||||
|
import tr from './translations/tr'
|
||||||
import ru from './translations/ru'
|
import ru from './translations/ru'
|
||||||
import zh from './translations/zh'
|
import zh from './translations/zh'
|
||||||
import zhTw from './translations/zhTw'
|
import zhTw from './translations/zhTw'
|
||||||
@@ -23,7 +24,7 @@ type TranslationStrings = Record<string, string | { name: string; category: stri
|
|||||||
|
|
||||||
// Keyed by SupportedLanguageCode so TypeScript enforces all languages have a translation.
|
// Keyed by SupportedLanguageCode so TypeScript enforces all languages have a translation.
|
||||||
const translations: Record<SupportedLanguageCode, TranslationStrings> = {
|
const translations: Record<SupportedLanguageCode, TranslationStrings> = {
|
||||||
de, en, es, fr, hu, it, ru, zh, 'zh-TW': zhTw, nl, id, ar, br, cs, pl,
|
de, en, es, fr, hu, it, tr, ru, zh, 'zh-TW': zhTw, nl, id, ar, br, cs, pl,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Derived from SUPPORTED_LANGUAGES — add new languages there, not here.
|
// Derived from SUPPORTED_LANGUAGES — add new languages there, not here.
|
||||||
@@ -38,7 +39,7 @@ export function getLocaleForLanguage(language: string): string {
|
|||||||
|
|
||||||
export function getIntlLanguage(language: string): string {
|
export function getIntlLanguage(language: string): string {
|
||||||
if (language === 'br') return 'pt-BR'
|
if (language === 'br') return 'pt-BR'
|
||||||
return ['de', 'es', 'fr', 'hu', 'it', 'ru', 'zh', 'zh-TW', 'nl', 'ar', 'cs', 'pl', 'id'].includes(language) ? language : 'en'
|
return ['de', 'es', 'fr', 'hu', 'it', 'tr', 'ru', 'zh', 'zh-TW', 'nl', 'ar', 'cs', 'pl', 'id'].includes(language) ? language : 'en'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isRtlLanguage(language: string): boolean {
|
export function isRtlLanguage(language: string): boolean {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const SUPPORTED_LANGUAGES = [
|
|||||||
{ value: 'zh', label: '简体中文', locale: 'zh-CN' },
|
{ value: 'zh', label: '简体中文', locale: 'zh-CN' },
|
||||||
{ value: 'zh-TW', label: '繁體中文', locale: 'zh-TW' },
|
{ value: 'zh-TW', label: '繁體中文', locale: 'zh-TW' },
|
||||||
{ value: 'it', label: 'Italiano', locale: 'it-IT' },
|
{ value: 'it', label: 'Italiano', locale: 'it-IT' },
|
||||||
|
{ value: 'tr', label: 'Türkçe', locale: 'tr-TR' },
|
||||||
{ value: 'ar', label: 'العربية', locale: 'ar-SA' },
|
{ value: 'ar', label: 'العربية', locale: 'ar-SA' },
|
||||||
{ value: 'id', label: 'Bahasa Indonesia', locale: 'id-ID' },
|
{ value: 'id', label: 'Bahasa Indonesia', locale: 'id-ID' },
|
||||||
] as const
|
] as const
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -91,8 +91,9 @@ describe('isRtlLanguage', () => {
|
|||||||
describe('SUPPORTED_LANGUAGES', () => {
|
describe('SUPPORTED_LANGUAGES', () => {
|
||||||
it('FE-COMP-I18N-009: contains expected entries with value/label shape', () => {
|
it('FE-COMP-I18N-009: contains expected entries with value/label shape', () => {
|
||||||
expect(Array.isArray(SUPPORTED_LANGUAGES)).toBe(true)
|
expect(Array.isArray(SUPPORTED_LANGUAGES)).toBe(true)
|
||||||
expect(SUPPORTED_LANGUAGES).toHaveLength(15)
|
expect(SUPPORTED_LANGUAGES).toHaveLength(16)
|
||||||
expect(SUPPORTED_LANGUAGES).toContainEqual(expect.objectContaining({ value: 'en', label: 'English' }))
|
expect(SUPPORTED_LANGUAGES).toContainEqual(expect.objectContaining({ value: 'en', label: 'English' }))
|
||||||
|
expect(SUPPORTED_LANGUAGES).toContainEqual(expect.objectContaining({ value: 'tr', label: 'Türkçe' }))
|
||||||
expect(SUPPORTED_LANGUAGES).toContainEqual(expect.objectContaining({ value: 'ar', label: 'العربية' }))
|
expect(SUPPORTED_LANGUAGES).toContainEqual(expect.objectContaining({ value: 'ar', label: 'العربية' }))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user