feat(webapp): ukrainian language translation (#9371)

This commit is contained in:
Ulf Gebhardt 2026-03-12 16:09:23 +01:00 committed by GitHub
parent 0df685f372
commit 9d048b67f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 1296 additions and 4 deletions

View File

@ -3,7 +3,7 @@
ROOT_DIR=$(dirname "$0")/../..
tmp=$(mktemp)
locale_list=("es.json" "fr.json" "it.json" "nl.json" "pl.json" "pt.json" "ru.json")
locale_list=("es.json" "fr.json" "it.json" "nl.json" "pl.json" "pt.json" "ru.json" "uk.json")
for locale_file in "${locale_list[@]}"
do

View File

@ -1,4 +1,4 @@
import { enUS, de, nl, fr, es, it, pt, pl, ru, sq } from 'date-fns/locale'
import { enUS, de, nl, fr, es, it, pt, pl, ru, sq, uk } from 'date-fns/locale'
import find from 'lodash/find'
const locales = [
@ -82,6 +82,14 @@ const locales = [
enabled: true,
dateFnsLocale: sq,
},
{
name: 'Українська',
code: 'uk',
iso: 'uk-UA',
flag: '🇺🇦',
enabled: true,
dateFnsLocale: uk,
},
]
export default locales

1281
webapp/locales/uk.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,9 +4,11 @@ import { isEmpty, find } from 'lodash'
import locales from '~/locales'
import htmlTranslations from '~/locales/html/'
let fallbackLocale
const registerTranslation = ({ Vue, locale }) => {
const translation = require(`~/locales/${locale}.json`)
translation.html = htmlTranslations[locale]
translation.html = htmlTranslations[locale] || htmlTranslations[fallbackLocale]
Vue.i18n.add(locale, translation)
}
@ -15,6 +17,7 @@ const registerTranslation = ({ Vue, locale }) => {
* and implement the user preference logic
*/
export default ({ app, req, cookie, store }) => {
fallbackLocale = app.$env.LANGUAGE_FALLBACK
const debug = app.$env && app.$env.NODE_ENV !== 'production'
const key = 'locale'
@ -45,7 +48,7 @@ export default ({ app, req, cookie, store }) => {
if (!app.$i18n.localeExists(localeInStore)) {
import(`~/locales/${localeInStore}.json`).then((res) => {
const translation = res.default
translation.html = htmlTranslations[localeInStore]
translation.html = htmlTranslations[localeInStore] || htmlTranslations[fallbackLocale]
app.$i18n.add(localeInStore, translation)
})
}