Skip to content

Commit

Permalink
Add Swedish localization (#7232)
Browse files Browse the repository at this point in the history
* Adding Swedish translation

* Fixes and improvements

* Fixes and improvements

* Fixed inconsistencies + some other improvements

* Made some improvements, added missing translations and added Swedish to app.config.js

* Force push to resolve conflicts in messages.po
  • Loading branch information
nilaallj authored Jan 24, 2025
1 parent 630a8c3 commit 9cb3b59
Show file tree
Hide file tree
Showing 8 changed files with 8,321 additions and 0 deletions.
1 change: 1 addition & 0 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module.exports = function (config) {
'pt-BR',
'ro',
'ru',
'sv',
'th',
'tr',
'uk',
Expand Down
1 change: 1 addition & 0 deletions lingui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = {
'pt-BR',
'ro',
'ru',
'sv',
'th',
'tr',
'uk',
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 @@ -31,6 +31,7 @@ import {
ptBR,
ro,
ru,
sv,
th,
tr,
uk,
Expand Down Expand Up @@ -73,6 +74,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
['pt-BR']: ptBR,
ro,
ru,
sv,
th,
tr,
uk,
Expand Down
2 changes: 2 additions & 0 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.ro
case 'ru':
return AppLanguage.ru
case 'sv':
return AppLanguage.sv
case 'th':
return AppLanguage.th
case 'tr':
Expand Down
9 changes: 9 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {messages as messagesPl} from '#/locale/locales/pl/messages'
import {messages as messagesPt_BR} from '#/locale/locales/pt-BR/messages'
import {messages as messagesRo} from '#/locale/locales/ro/messages'
import {messages as messagesRu} from '#/locale/locales/ru/messages'
import {messages as messagesSv} from '#/locale/locales/sv/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'
Expand Down Expand Up @@ -247,6 +248,14 @@ export async function dynamicActivate(locale: AppLanguage) {
])
break
}
case AppLanguage.sv: {
i18n.loadAndActivate({locale, messages: messagesSv})
await Promise.all([
import('@formatjs/intl-pluralrules/locale-data/sv'),
import('@formatjs/intl-numberformat/locale-data/sv'),
])
break
}
case AppLanguage.th: {
i18n.loadAndActivate({locale, messages: messagesTh})
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 @@ -112,6 +112,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/ru/messages`)
break
}
case AppLanguage.sv: {
mod = await import(`./locales/sv/messages`)
break
}
case AppLanguage.th: {
mod = await import(`./locales/th/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 @@ -31,6 +31,7 @@ export enum AppLanguage {
pt_BR = 'pt-BR',
ro = 'ro',
ru = 'ru',
sv = 'sv',
th = 'th',
tr = 'tr',
uk = 'uk',
Expand Down Expand Up @@ -72,6 +73,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.pt_BR, name: 'Português (BR) – Portuguese (BR)'},
{code2: AppLanguage.ro, name: 'Română – Romanian'},
{code2: AppLanguage.ru, name: 'Русский – Russian'},
{code2: AppLanguage.sv, name: 'Svenska – Swedish'},
{code2: AppLanguage.th, name: 'ภาษาไทย – Thai'},
{code2: AppLanguage.tr, name: 'Türkçe – Turkish'},
{code2: AppLanguage.uk, name: 'Українська – Ukrainian'},
Expand Down
Loading

0 comments on commit 9cb3b59

Please sign in to comment.