Add turkish to app languages

zio/stable
Paul Frazee 2024-04-03 16:50:15 -07:00
parent a4d4562aba
commit 55e4ea84f8
5 changed files with 26 additions and 11 deletions

View File

@ -16,6 +16,7 @@ module.exports = {
'zh-CN',
'zh-TW',
'it',
'tr',
],
catalogs: [
{

View File

@ -1,7 +1,8 @@
import {AppBskyFeedDefs, AppBskyFeedPost} from '@atproto/api'
import lande from 'lande'
import {hasProp} from 'lib/type-guards'
import * as bcp47Match from 'bcp-47-match'
import lande from 'lande'
import {hasProp} from 'lib/type-guards'
import {
AppLanguage,
LANGUAGES_MAP_CODE2,
@ -146,6 +147,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.zh_TW
case 'it':
return AppLanguage.it
case 'tr':
return AppLanguage.tr
default:
continue
}

View File

@ -1,25 +1,25 @@
import {useEffect} from 'react'
import {i18n} from '@lingui/core'
import {useLanguagePrefs} from '#/state/preferences'
import {messages as messagesEn} from '#/locale/locales/en/messages'
import {sanitizeAppLanguageSetting} from '#/locale/helpers'
import {AppLanguage} from '#/locale/languages'
import {messages as messagesCa} from '#/locale/locales/ca/messages'
import {messages as messagesDe} from '#/locale/locales/de/messages'
import {messages as messagesId} from '#/locale/locales/id/messages'
import {messages as messagesEn} from '#/locale/locales/en/messages'
import {messages as messagesEs} from '#/locale/locales/es/messages'
import {messages as messagesFi} from '#/locale/locales/fi/messages'
import {messages as messagesFr} from '#/locale/locales/fr/messages'
import {messages as messagesHi} from '#/locale/locales/hi/messages'
import {messages as messagesId} from '#/locale/locales/id/messages'
import {messages as messagesIt} from '#/locale/locales/it/messages'
import {messages as messagesJa} from '#/locale/locales/ja/messages'
import {messages as messagesKo} from '#/locale/locales/ko/messages'
import {messages as messagesPt_BR} from '#/locale/locales/pt-BR/messages'
import {messages as messagesTr} from '#/locale/locales/tr/messages'
import {messages as messagesUk} from '#/locale/locales/uk/messages'
import {messages as messagesCa} from '#/locale/locales/ca/messages'
import {messages as messagesZh_CN} from '#/locale/locales/zh-CN/messages'
import {messages as messagesZh_TW} from '#/locale/locales/zh-TW/messages'
import {messages as messagesIt} from '#/locale/locales/it/messages'
import {sanitizeAppLanguageSetting} from '#/locale/helpers'
import {AppLanguage} from '#/locale/languages'
import {useLanguagePrefs} from '#/state/preferences'
/**
* We do a dynamic import of just the catalog that we need
@ -80,6 +80,11 @@ export async function dynamicActivate(locale: AppLanguage) {
}
case AppLanguage.zh_TW: {
i18n.loadAndActivate({locale, messages: messagesZh_TW})
break
}
case AppLanguage.tr: {
i18n.loadAndActivate({locale, messages: messagesTr})
break
}
default: {
i18n.loadAndActivate({locale, messages: messagesEn})

View File

@ -1,9 +1,9 @@
import {useEffect} from 'react'
import {i18n} from '@lingui/core'
import {useLanguagePrefs} from '#/state/preferences'
import {sanitizeAppLanguageSetting} from '#/locale/helpers'
import {AppLanguage} from '#/locale/languages'
import {useLanguagePrefs} from '#/state/preferences'
/**
* We do a dynamic import of just the catalog that we need
@ -68,6 +68,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/it/messages`)
break
}
case AppLanguage.tr: {
mod = await import(`./locales/tr/messages`)
break
}
default: {
mod = await import(`./locales/en/messages`)
break

View File

@ -20,6 +20,7 @@ export enum AppLanguage {
zh_CN = 'zh-CN',
zh_TW = 'zh-TW',
it = 'it',
tr = 'tr',
}
interface AppLanguageConfig {
@ -43,6 +44,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.zh_CN, name: '简体中文(中国) Chinese (Simplified)'},
{code2: AppLanguage.zh_TW, name: '繁體中文(臺灣) Chinese (Traditional)'},
{code2: AppLanguage.it, name: 'Italiano - Italian'},
{code2: AppLanguage.tr, name: 'Türkçe - Turkish'},
]
export const LANGUAGES: Language[] = [