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