Skip to content

Commit

Permalink
feat: pt-PT locale support
Browse files Browse the repository at this point in the history
fix: post language doesn't sup regional distinctions

fix: pt case

fix: pt-PT .po header info
  • Loading branch information
joaomendoncaa committed Nov 29, 2024
1 parent d08ce0d commit bebd875
Show file tree
Hide file tree
Showing 7 changed files with 9,758 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 @@ -21,6 +21,7 @@ module.exports = {
'nl',
'pl',
'pt-BR',
'pt-PT',
'ru',
'th',
'tr',
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 @@ -25,6 +25,7 @@ import {
ko,
nl,
pl,
pt,
ptBR,
ru,
th,
Expand Down Expand Up @@ -62,6 +63,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
ko,
nl,
pl,
['pt-PT']: pt,
['pt-BR']: ptBR,
ru,
th,
Expand Down
4 changes: 4 additions & 0 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.pl
case 'pt-BR':
return AppLanguage.pt_BR
case 'pt-PT':
return AppLanguage.pt_PT
case 'pt':
return AppLanguage.pt_BR
case 'ru':
return AppLanguage.ru
case 'th':
Expand Down
9 changes: 9 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {messages as messagesKo} from '#/locale/locales/ko/messages'
import {messages as messagesNl} from '#/locale/locales/nl/messages'
import {messages as messagesPl} from '#/locale/locales/pl/messages'
import {messages as messagesPt_BR} from '#/locale/locales/pt-BR/messages'
import {messages as messagesPt_PT} from '#/locale/locales/pt-PT/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'
Expand Down Expand Up @@ -198,6 +199,14 @@ export async function dynamicActivate(locale: AppLanguage) {
])
break
}
case AppLanguage.pt_PT: {
i18n.loadAndActivate({locale, messages: messagesPt_PT})
await Promise.all([
import('@formatjs/intl-pluralrules/locale-data/pt'),
import('@formatjs/intl-numberformat/locale-data/pt'),
])
break
}
case AppLanguage.ru: {
i18n.loadAndActivate({locale, messages: messagesRu})
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 @@ -88,6 +88,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/pt-BR/messages`)
break
}
case AppLanguage.pt_PT: {
mod = await import(`./locales/pt-PT/messages`)
break
}
case AppLanguage.ru: {
mod = await import(`./locales/ru/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 @@ -25,6 +25,7 @@ export enum AppLanguage {
nl = 'nl',
pl = 'pl',
pt_BR = 'pt-BR',
pt_PT = 'pt-PT',
ru = 'ru',
th = 'th',
tr = 'tr',
Expand Down Expand Up @@ -61,6 +62,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.nl, name: 'Nederlands – Dutch'},
{code2: AppLanguage.pl, name: 'Polski – Polish'},
{code2: AppLanguage.pt_BR, name: 'Português (BR) – Portuguese (BR)'},
{code2: AppLanguage.pt_PT, name: 'Português (PT) – Portuguese (PT)'},
{code2: AppLanguage.ru, name: 'Русский – Russian'},
{code2: AppLanguage.th, name: 'ภาษาไทย – Thai'},
{code2: AppLanguage.tr, name: 'Türkçe – Turkish'},
Expand Down
Loading

0 comments on commit bebd875

Please sign in to comment.