mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-03-23 02:35:28 +00:00
feat(webapp): ukrainian language translation (#9371)
This commit is contained in:
parent
0df685f372
commit
9d048b67f9
@ -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
|
||||
|
||||
@ -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
1281
webapp/locales/uk.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user