mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
improve inheritance with translations i18n.js files
vue-i18n --> chill main i18n ---( )---> app index chill bundle i18n --> app i18n --^
This commit is contained in:
parent
ec68e6f761
commit
4900c81c11
@ -0,0 +1,52 @@
|
||||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
const datetimeFormats = {
|
||||
fr: {
|
||||
short: {
|
||||
year: "numeric",
|
||||
month: "numeric",
|
||||
day: "numeric"
|
||||
},
|
||||
long: {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
weekday: "short",
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
hour12: false
|
||||
}
|
||||
}
|
||||
};
|
||||
const messages = {
|
||||
fr: {
|
||||
action: {
|
||||
actions: "Actions",
|
||||
show: "Voir",
|
||||
edit: "Modifier",
|
||||
create: "Créer",
|
||||
remove: "Enlever",
|
||||
delete: "Supprimer",
|
||||
save: "Enregistrer",
|
||||
show_modal: "Ouvrir une modale",
|
||||
ok: "OK",
|
||||
cancel: "Annuler",
|
||||
close: "Fermer",
|
||||
next: "Suivant",
|
||||
previous: "Précédent",
|
||||
back: "Retour"
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const _createI18n = (appMessages) => {
|
||||
Object.assign(messages.fr, appMessages.fr);
|
||||
return createI18n({
|
||||
datetimeFormats,
|
||||
messages,
|
||||
locale: 'fr',
|
||||
fallbackLocale: 'fr'
|
||||
})
|
||||
};
|
||||
|
||||
export { _createI18n }
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h3>{{ $t('title.course') }}</h3>
|
||||
<h3>{{ $t('course.title') }}</h3>
|
||||
<dl>
|
||||
<dt>{{ $t('course.id') }}</dt>
|
||||
<dd>{{ accompanying_course.id }}</dd>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h3>{{ $t('title.persons_associated')}}</h3>
|
||||
<h3>{{ $t('persons_associated.title')}}</h3>
|
||||
<label>{{ $tc('persons_associated.counter', counter) }}</label>
|
||||
<table class="rounded">
|
||||
<thead>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="vue-component">
|
||||
<h3>{{ $t('title.requestor') }}</h3>
|
||||
<h3>{{ $t('requestor.title') }}</h3>
|
||||
{{ accompanying_course.id }}
|
||||
{{ accompanying_course.remark }}<br><br>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button class="sc-button bt-create" @click="modal1.showModal = true">
|
||||
{{ $t('action.showModal') }}
|
||||
{{ $t('action.show_modal') }}
|
||||
</button>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import { datetimeFormats, messages } from './js/i18n'
|
||||
import { getDataPromise, postDataPromise } from './store'
|
||||
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
|
||||
import { appMessages } from './js/i18n'
|
||||
import { getDataPromise } from './store'
|
||||
|
||||
import App from './App.vue';
|
||||
|
||||
@ -10,12 +10,7 @@ getDataPromise.then(store => {
|
||||
//console.log('store in create_store', store);
|
||||
console.log('store accompanyingCourse', store.state.accompanying_course);
|
||||
|
||||
const i18n = createI18n({
|
||||
datetimeFormats,
|
||||
messages,
|
||||
locale: 'fr',
|
||||
fallbackLocale: 'fr'
|
||||
});
|
||||
const i18n = _createI18n(appMessages);
|
||||
|
||||
const app = createApp({
|
||||
template: `<app></app>`,
|
||||
|
@ -1,33 +1,32 @@
|
||||
import { datetimeFormats, personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
||||
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n'
|
||||
|
||||
const messages = {
|
||||
const appMessages = {
|
||||
fr: {
|
||||
title: {
|
||||
course: "Parcours",
|
||||
persons_associated: "Usagers concernés",
|
||||
requestor: "Demandeur",
|
||||
},
|
||||
course: {
|
||||
id: "id",
|
||||
title: "Parcours",
|
||||
opening_date: "Date d'ouverture",
|
||||
closing_date: "Date de clôture",
|
||||
remark: "Commentaire",
|
||||
closing_motive: "Motif de clôture",
|
||||
},
|
||||
persons_associated: {
|
||||
title: "Usagers concernés",
|
||||
counter: "Pas d'usager | 1 usager | {count} usagers",
|
||||
firstname: "Prénom",
|
||||
lastname: "Nom",
|
||||
startdate: "Date d'entrée",
|
||||
enddate: "Date de sortie",
|
||||
addPerson: "Ajouter un usager",
|
||||
}
|
||||
},
|
||||
requestor: {
|
||||
title: "Demandeur",
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Object.assign(messages.fr, personMessages.fr);
|
||||
Object.assign(appMessages.fr, personMessages.fr);
|
||||
|
||||
export {
|
||||
datetimeFormats,
|
||||
messages
|
||||
appMessages
|
||||
};
|
||||
|
@ -1,43 +1,12 @@
|
||||
const datetimeFormats = {
|
||||
fr: {
|
||||
short: {
|
||||
year: "numeric",
|
||||
month: "numeric",
|
||||
day: "numeric"
|
||||
},
|
||||
long: {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
weekday: "short",
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
hour12: false
|
||||
}
|
||||
}
|
||||
};
|
||||
const personMessages = {
|
||||
fr: {
|
||||
action: {
|
||||
actions: "Actions",
|
||||
show: "Voir",
|
||||
edit: "Modifier",
|
||||
create: "Créer",
|
||||
remove: "Enlever",
|
||||
delete: "Supprimer",
|
||||
save: "Enregistrer",
|
||||
showModal: "Ouvrir une modale",
|
||||
ok: "OK",
|
||||
cancel: "Annuler",
|
||||
close: "Fermer",
|
||||
next: "Suivant",
|
||||
previous: "Précédent",
|
||||
back: "Retour"
|
||||
add_persons: {
|
||||
search_add_others_persons: "Rechercher et ajouter d'autres usagers",
|
||||
title: "Ajouter des usagers",
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
datetimeFormats,
|
||||
personMessages
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user