Skip to content

Commit

Permalink
add Thai Language translation support (bluesky-social#5879)
Browse files Browse the repository at this point in the history
* add Thai Language support

* Update lingui.config.js

* Update dates.ts

* Update helpers.ts

* Update i18n.ts

* Update i18n.web.ts

* Update languages.ts

* Update messages.po

---------

Co-authored-by: surfdude29 <[email protected]>
  • Loading branch information
Rinechxn and surfdude29 authored Oct 30, 2024
1 parent e9f6a8e commit 9a82d20
Show file tree
Hide file tree
Showing 7 changed files with 8,982 additions and 0 deletions.
1 change: 1 addition & 0 deletions lingui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
'ko',
'pt-BR',
'ru',
'th',
'tr',
'uk',
'zh-CN',
Expand Down
2 changes: 2 additions & 0 deletions src/components/hooks/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
ko,
ptBR,
ru,
th,
tr,
uk,
zhCN,
Expand Down Expand Up @@ -54,6 +55,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
ko,
['pt-BR']: ptBR,
ru,
th,
tr,
uk,
['zh-CN']: zhCN,
Expand Down
2 changes: 2 additions & 0 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.pt_BR
case 'ru':
return AppLanguage.ru
case 'th':
return AppLanguage.th
case 'tr':
return AppLanguage.tr
case 'uk':
Expand Down
9 changes: 9 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ 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 messagesRu} from '#/locale/locales/ru/messages'
import {messages as messagesTh} from '#/locale/locales/th/messages'
import {messages as messagesTr} from '#/locale/locales/tr/messages'
import {messages as messagesUk} from '#/locale/locales/uk/messages'
import {messages as messagesZh_CN} from '#/locale/locales/zh-CN/messages'
Expand Down Expand Up @@ -159,6 +160,14 @@ export async function dynamicActivate(locale: AppLanguage) {
])
break
}
case AppLanguage.th: {
i18n.loadAndActivate({locale, messages: messagesTh})
await Promise.all([
import('@formatjs/intl-pluralrules/locale-data/th'),
import('@formatjs/intl-numberformat/locale-data/th'),
])
break
}
case AppLanguage.tr: {
i18n.loadAndActivate({locale, messages: messagesTr})
await Promise.all([
Expand Down
4 changes: 4 additions & 0 deletions src/locale/i18n.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/ru/messages`)
break
}
case AppLanguage.th: {
mod = await import(`./locales/th/messages`)
break
}
case AppLanguage.tr: {
mod = await import(`./locales/tr/messages`)
break
Expand Down
2 changes: 2 additions & 0 deletions src/locale/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export enum AppLanguage {
ko = 'ko',
pt_BR = 'pt-BR',
ru = 'ru',
th = 'th',
tr = 'tr',
uk = 'uk',
zh_CN = 'zh-CN',
Expand Down Expand Up @@ -50,6 +51,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.ko, name: '한국어 – Korean'},
{code2: AppLanguage.pt_BR, name: 'Português (BR) – Portuguese (BR)'},
{code2: AppLanguage.ru, name: 'Русский – Russian'},
{code2: AppLanguage.th, name: 'ภาษาไทย – Thai'},
{code2: AppLanguage.tr, name: 'Türkçe – Turkish'},
{code2: AppLanguage.uk, name: 'Українська – Ukrainian'},
{code2: AppLanguage.zh_CN, name: '简体中文 – Simplified Chinese'},
Expand Down
Loading

0 comments on commit 9a82d20

Please sign in to comment.