API & Client - enable es, gl and nb translations
This commit is contained in:
parent
81679c2068
commit
1797409765
@ -62,10 +62,10 @@ class BaseConfig:
|
||||
'fr',
|
||||
'de',
|
||||
'it',
|
||||
# 'nb', # disabled for now
|
||||
'nb',
|
||||
'nl',
|
||||
# 'es', # disabled for now
|
||||
# 'gl', # disabled for now
|
||||
'es',
|
||||
'gl',
|
||||
]
|
||||
OAUTH2_TOKEN_EXPIRES_IN = {
|
||||
'authorization_code': 864000, # 10 days
|
||||
|
@ -6,18 +6,13 @@ import { createI18n, LocaleMessages, VueMessageType } from 'vue-i18n'
|
||||
* The loaded `JSON` locale messages is pre-compiled by `@intlify/vue-i18n-loader`, which is integrated into `vue-cli-plugin-i18n`.
|
||||
* See: https://github.com/intlify/vue-i18n-loader#rocket-i18n-resource-pre-compilation
|
||||
*/
|
||||
const disabledLanguages = ['nb', 'es', 'gl'] // to update after translations release
|
||||
|
||||
function loadLocaleMessages(): Record<string, LocaleMessages<VueMessageType>> {
|
||||
const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.ts$/i)
|
||||
const messages: Record<string, LocaleMessages<VueMessageType>> = {}
|
||||
locales.keys().forEach((key) => {
|
||||
const matched = key.match(/([A-Za-z0-9-_]+)\./i)
|
||||
if (
|
||||
matched &&
|
||||
matched.length > 1 &&
|
||||
!disabledLanguages.includes(matched[1])
|
||||
) {
|
||||
if (matched && matched.length > 1) {
|
||||
const locale = matched[1]
|
||||
messages[locale] = locales(key).default
|
||||
}
|
||||
|
@ -96,11 +96,11 @@ const availableDateFormats = [
|
||||
export const dateStringFormats: Record<string, string> = {
|
||||
de: 'do MMM yyyy',
|
||||
en: 'MMM. do, yyyy',
|
||||
// es: 'd MMM yyyy',
|
||||
es: 'd MMM yyyy',
|
||||
fr: 'd MMM yyyy',
|
||||
// gl: 'd MMM yyyy',
|
||||
gl: 'd MMM yyyy',
|
||||
it: 'd MMM yyyy',
|
||||
// nb: 'do MMM yyyy',
|
||||
nb: 'do MMM yyyy',
|
||||
nl: 'd MMM yyyy',
|
||||
}
|
||||
|
||||
|
@ -1,28 +1,28 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
import { Locale } from 'date-fns'
|
||||
import { de, enUS, fr, it, nl } from 'date-fns/locale'
|
||||
import { de, enUS, es, fr, gl, it, nb, nl } from 'date-fns/locale'
|
||||
|
||||
import createI18n from '@/i18n'
|
||||
|
||||
export const localeFromLanguage: Record<string, Locale> = {
|
||||
de: de,
|
||||
en: enUS,
|
||||
// es: es, // disabled for now
|
||||
es: es,
|
||||
fr: fr,
|
||||
// gl: gl, // disabled for now
|
||||
gl: gl,
|
||||
it: it,
|
||||
// nb: nb, // disabled for now
|
||||
nb: nb,
|
||||
nl: nl,
|
||||
}
|
||||
|
||||
export const languageLabels: Record<string, string> = {
|
||||
de: 'Deutsch',
|
||||
en: 'English',
|
||||
// es: 'Español', // disabled for now
|
||||
es: 'Español',
|
||||
fr: 'Français',
|
||||
// gl: 'Galego', // disabled for now
|
||||
gl: 'Galego',
|
||||
it: 'Italiano',
|
||||
// nb: 'Norsk bokmål', // disabled for now
|
||||
nb: 'Norsk bokmål',
|
||||
nl: 'Nederlands',
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,10 @@ export const loadLanguagePackage = async (language: string) => {
|
||||
return await import(
|
||||
/* webpackChunkName: "password.it" */ '@zxcvbn-ts/language-it'
|
||||
)
|
||||
// case 'es':
|
||||
// return await import(
|
||||
// /* webpackChunkName: "password.es" */ '@zxcvbn-ts/language-es-es'
|
||||
// )
|
||||
case 'es':
|
||||
return await import(
|
||||
/* webpackChunkName: "password.es" */ '@zxcvbn-ts/language-es-es'
|
||||
)
|
||||
default:
|
||||
return await import(
|
||||
/* webpackChunkName: "password.en" */ '@zxcvbn-ts/language-en'
|
||||
|
Loading…
Reference in New Issue
Block a user