API & Client - enable pl translations

This commit is contained in:
Sam 2023-06-24 19:14:02 +02:00
parent 8b60ca181f
commit b1c8a1c376
7 changed files with 21 additions and 21 deletions

View File

@ -66,7 +66,7 @@ class BaseConfig:
'nl', 'nl',
'es', 'es',
'gl', 'gl',
# 'pl', # disabled for now 'pl',
] ]
OAUTH2_TOKEN_EXPIRES_IN = { OAUTH2_TOKEN_EXPIRES_IN = {
'authorization_code': 864000, # 10 days 'authorization_code': 864000, # 10 days

View File

@ -20,6 +20,7 @@
"@zxcvbn-ts/language-es-es": "^3.0.1", "@zxcvbn-ts/language-es-es": "^3.0.1",
"@zxcvbn-ts/language-fr": "^3.0.1", "@zxcvbn-ts/language-fr": "^3.0.1",
"@zxcvbn-ts/language-it": "^3.0.1", "@zxcvbn-ts/language-it": "^3.0.1",
"@zxcvbn-ts/language-pl": "^3.0.1",
"axios": "^1.4.0", "axios": "^1.4.0",
"chart.js": "^4.3.0", "chart.js": "^4.3.0",
"chartjs-plugin-datalabels": "^2.2.0", "chartjs-plugin-datalabels": "^2.2.0",

View File

@ -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 = ['pl'] // 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
} }

View File

@ -100,7 +100,7 @@ export const dateStringFormats: Record<string, string> = {
fr: 'd MMM yyyy', fr: 'd MMM yyyy',
gl: 'd MMM yyyy', gl: 'd MMM yyyy',
it: 'd MMM yyyy', it: 'd MMM yyyy',
// pl: 'd MMM yyyy', // disabled for now pl: 'd MMM yyyy',
nb: 'do MMM yyyy', nb: 'do MMM yyyy',
nl: 'd MMM yyyy', nl: 'd MMM yyyy',
} }

View File

@ -1,6 +1,6 @@
/* eslint-disable import/no-duplicates */ /* eslint-disable import/no-duplicates */
import { Locale } from 'date-fns' import { Locale } from 'date-fns'
import { de, enUS, es, fr, gl, it, nb, nl } from 'date-fns/locale' import { de, enUS, es, fr, gl, it, nb, nl, pl } from 'date-fns/locale'
import createI18n from '@/i18n' import createI18n from '@/i18n'
@ -11,7 +11,7 @@ export const localeFromLanguage: Record<string, Locale> = {
fr: fr, fr: fr,
gl: gl, gl: gl,
it: it, it: it,
// pl: pl, pl: pl,
nb: nb, nb: nb,
nl: nl, nl: nl,
} }
@ -22,10 +22,10 @@ export const languageLabels: Record<string, string> = {
es: 'Español', es: 'Español',
fr: 'Français', fr: 'Français',
gl: 'Galego', gl: 'Galego',
it: 'Italiano', it: 'Italiano (87%)',
// pl: 'Polski', nb: 'Norsk bokmål (36%)',
nb: 'Norsk bokmål',
nl: 'Nederlands', nl: 'Nederlands',
pl: 'Polski (43%)',
} }
const { availableLocales } = createI18n.global const { availableLocales } = createI18n.global

View File

@ -2,9 +2,9 @@ import { zxcvbnOptions } from '@zxcvbn-ts/core'
export const loadLanguagePackage = async (language: string) => { export const loadLanguagePackage = async (language: string) => {
// no package available for // no package available for
// - dutch (Nederlands) // - Dutch (Nederlands)
// - galician // - Galician
// - norwegian bokmal // - Norwegian bokmal
// fallback to english // fallback to english
switch (language) { switch (language) {
case 'fr': case 'fr':
@ -23,11 +23,10 @@ export const loadLanguagePackage = async (language: string) => {
return await import( return await import(
/* webpackChunkName: "password.es" */ '@zxcvbn-ts/language-es-es' /* webpackChunkName: "password.es" */ '@zxcvbn-ts/language-es-es'
) )
// TODO: add package case 'pl':
// case 'pl': return await import(
// return await import( /* webpackChunkName: "password.pl" */ '@zxcvbn-ts/language-pl'
// /* webpackChunkName: "password.pl" */ '@zxcvbn-ts/language-pl' )
// )
default: default:
return await import( return await import(
/* webpackChunkName: "password.en" */ '@zxcvbn-ts/language-en' /* webpackChunkName: "password.en" */ '@zxcvbn-ts/language-en'

View File

@ -2298,6 +2298,11 @@
resolved "https://registry.yarnpkg.com/@zxcvbn-ts/language-it/-/language-it-3.0.1.tgz#3f6dfe8d4951f91c108ec00d941d1ce3b0053393" resolved "https://registry.yarnpkg.com/@zxcvbn-ts/language-it/-/language-it-3.0.1.tgz#3f6dfe8d4951f91c108ec00d941d1ce3b0053393"
integrity sha512-ejuxUsame0+kR1mJStCrUFtuByFCLGU4sdW9ZvcbjQ7K1UrzMsfLNSmA48M5FoicdY79twyJw1YWSUFyJFmt+g== integrity sha512-ejuxUsame0+kR1mJStCrUFtuByFCLGU4sdW9ZvcbjQ7K1UrzMsfLNSmA48M5FoicdY79twyJw1YWSUFyJFmt+g==
"@zxcvbn-ts/language-pl@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@zxcvbn-ts/language-pl/-/language-pl-3.0.1.tgz#4658fe112045a51e2d96277725e546fbf4a04160"
integrity sha512-Sqc/u4b0q7rb6pYSQuf34HgdjIqo0Rd5aeouV9jJEUr6TDZl1l9yuj6YdAQy+ZAOMHz1e0lLnp930oY+xI6fGA==
abab@^2.0.5, abab@^2.0.6: abab@^2.0.5, abab@^2.0.6:
version "2.0.6" version "2.0.6"
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291"