Client - init Polish (pl) translation files

This commit is contained in:
Sam 2023-05-03 20:03:02 +02:00
parent d37f207cc8
commit 67d434aa6e
18 changed files with 56 additions and 1 deletions

View File

@ -6,13 +6,18 @@ 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 (matched && matched.length > 1) { if (
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

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1,29 @@
import AboutTranslations from './about.json'
import AdministrationTranslations from './administration.json'
import ApiTranslations from './api.json'
import ButtonsTranslations from './buttons.json'
import CommonTranslations from './common.json'
import DashboardTranslations from './dashboard.json'
import ErrorTranslations from './error.json'
import OAuth2Translations from './oauth2.json'
import PrivacyPolicyTranslations from './privacy_policy.json'
import SportsTranslations from './sports.json'
import StatisticsTranslations from './statistics.json'
import UserTranslations from './user.json'
import WorkoutsTranslations from './workouts.json'
export default {
about: AboutTranslations,
admin: AdministrationTranslations,
api: ApiTranslations,
buttons: ButtonsTranslations,
common: CommonTranslations,
dashboard: DashboardTranslations,
error: ErrorTranslations,
oauth2: OAuth2Translations,
privacy_policy: PrivacyPolicyTranslations,
sports: SportsTranslations,
statistics: StatisticsTranslations,
user: UserTranslations,
workouts: WorkoutsTranslations,
}

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -0,0 +1 @@
{ }

View File

@ -100,6 +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
nb: 'do MMM yyyy', nb: 'do MMM yyyy',
nl: 'd MMM yyyy', nl: 'd MMM yyyy',
} }

View File

@ -11,6 +11,7 @@ export const localeFromLanguage: Record<string, Locale> = {
fr: fr, fr: fr,
gl: gl, gl: gl,
it: it, it: it,
// pl: pl,
nb: nb, nb: nb,
nl: nl, nl: nl,
} }
@ -22,6 +23,7 @@ export const languageLabels: Record<string, string> = {
fr: 'Français', fr: 'Français',
gl: 'Galego', gl: 'Galego',
it: 'Italiano', it: 'Italiano',
// pl: 'Polski',
nb: 'Norsk bokmål', nb: 'Norsk bokmål',
nl: 'Nederlands', nl: 'Nederlands',
} }

View File

@ -23,6 +23,11 @@ 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':
// return await import(
// /* 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'