Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Danish localization #7220

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lingui.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('@lingui/conf').LinguiConfig} */
module.exports = {
locales: [
'da',
'en',
'an',
'ast',
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,
enGB,
es,
Expand Down Expand Up @@ -49,6 +50,7 @@ const locales: Record<AppLanguage, Locale | undefined> = {
an: undefined,
ast: undefined,
ca,
da,
de,
['en-GB']: enGB,
es,
Expand Down
2 changes: 2 additions & 0 deletions src/locale/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,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 'en-GB':
Expand Down
9 changes: 9 additions & 0 deletions src/locale/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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 messagesEn} from '#/locale/locales/en/messages'
import {messages as messagesEn_GB} from '#/locale/locales/en-GB/messages'
Expand Down Expand Up @@ -78,6 +79,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',
en_GB = 'en-GB',
es = 'es',
Expand Down Expand Up @@ -48,6 +49,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.en_GB, name: 'English (UK)'},
{code2: AppLanguage.es, name: 'Español – Spanish'},
Expand Down
Loading