Skip to content

Commit

Permalink
Add Danish localization (#7220)
Browse files Browse the repository at this point in the history
* Add Danish localization

* Fix

* Update src/locale/locales/da/messages.po

Co-authored-by: Frudrax Cheng <[email protected]>

* Typo

* Inconsistent translation of "draft"

* Do not use "post" as verb

* Change "post"/"repost" to "opslag"/"videredeling"

* Fix "About"

* Fix

* Add to iOS config

* Sort alphabetically

* Typo fixes by @kseistrup

* Fix gender of "opslag"

* Plural

* "videredeling" > "deling"

* Be specific that ÆØÅ is not allowed

* Add new strings from main

---------

Co-authored-by: Frudrax Cheng <[email protected]>
  • Loading branch information
c960657 and auroursa authored Jan 24, 2025
1 parent 9cb3b59 commit 68c4737
Show file tree
Hide file tree
Showing 8 changed files with 8,334 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 @@ -75,6 +75,7 @@ module.exports = function (config) {
'an',
'ast',
'ca',
'da',
'de',
'el',
'es',
Expand Down
1 change: 1 addition & 0 deletions lingui.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'an',
'ast',
'ca',
'da',
'de',
'el',
'en-GB',
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 @@ -11,6 +11,7 @@ import React from 'react'
import {formatDistance, Locale} from 'date-fns'
import {
ca,
da,
de,
el,
enGB,
Expand Down Expand Up @@ -52,6 +53,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
an: undefined,
ast: undefined,
ca,
da,
de,
el,
['en-GB']: enGB,
Expand Down
2 changes: 2 additions & 0 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage {
return AppLanguage.ast
case 'ca':
return AppLanguage.ca
case 'da':
return AppLanguage.da
case 'de':
return AppLanguage.de
case 'el':
Expand Down
9 changes: 9 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {AppLanguage} from '#/locale/languages'
import {messages as messagesAn} from '#/locale/locales/an/messages'
import {messages as messagesAst} from '#/locale/locales/ast/messages'
import {messages as messagesCa} from '#/locale/locales/ca/messages'
import {messages as messagesDa} from '#/locale/locales/da/messages'
import {messages as messagesDe} from '#/locale/locales/de/messages'
import {messages as messagesEl} from '#/locale/locales/el/messages'
import {messages as messagesEn} from '#/locale/locales/en/messages'
Expand Down Expand Up @@ -76,6 +77,14 @@ export async function dynamicActivate(locale: AppLanguage) {
])
break
}
case AppLanguage.da: {
i18n.loadAndActivate({locale, messages: messagesDa})
await Promise.all([
import('@formatjs/intl-pluralrules/locale-data/da'),
import('@formatjs/intl-numberformat/locale-data/da'),
])
break
}
case AppLanguage.de: {
i18n.loadAndActivate({locale, messages: messagesDe})
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 @@ -24,6 +24,10 @@ export async function dynamicActivate(locale: AppLanguage) {
mod = await import(`./locales/ca/messages`)
break
}
case AppLanguage.da: {
mod = await import(`./locales/da/messages`)
break
}
case AppLanguage.de: {
mod = await import(`./locales/de/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 @@ -9,6 +9,7 @@ export enum AppLanguage {
an = 'an',
ast = 'ast',
ca = 'ca',
da = 'da',
de = 'de',
el = 'el',
en_GB = 'en-GB',
Expand Down Expand Up @@ -51,6 +52,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [
{code2: AppLanguage.an, name: 'Aragonés – Aragonese'},
{code2: AppLanguage.ast, name: 'Asturianu – Asturian'},
{code2: AppLanguage.ca, name: 'Català – Catalan'},
{code2: AppLanguage.da, name: 'Dansk – Danish'},
{code2: AppLanguage.de, name: 'Deutsch – German'},
{code2: AppLanguage.el, name: 'Ελληνικά – Greek'},
{code2: AppLanguage.en_GB, name: 'English (UK)'},
Expand Down
Loading

0 comments on commit 68c4737

Please sign in to comment.