improve Address reusability: move i18n translations out of root component

This commit is contained in:
Mathieu Jaumotte 2021-08-12 16:14:17 +02:00
parent 76a4b24aa1
commit c302452e01
2 changed files with 8 additions and 7 deletions

View File

@ -15,7 +15,7 @@
@close="flag.showPane = false">
<template v-slot:header>
<h2 class="modal-title">{{ getTextTitle }}
<h2 class="modal-title">{{ $t(getTextTitle) }}
<span v-if="flag.loading" class="loading">
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
<span class="sr-only">Loading...</span>
@ -70,7 +70,7 @@
@close="flag.editPane = false">
<template v-slot:header>
<h2 class="modal-title">{{ getTextTitle }}
<h2 class="modal-title">{{ $t(getTextTitle) }}
<span v-if="flag.loading" class="loading">
<i class="fa fa-circle-o-notch fa-spin fa-fw"></i>
<span class="sr-only">Loading...</span>
@ -126,9 +126,14 @@ import { postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress/
import ShowAddress from './ShowAddress.vue';
import EditAddress from './EditAddress.vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
import { addressMessages } from '../i18n'
const i18n = _createI18n(addressMessages);
export default {
name: "AddAddress",
props: ['context', 'options', 'result'],
i18n,
components: {
Modal,
ShowAddress,
@ -211,7 +216,7 @@ export default {
)) {
return (this.context.edit) ? this.options.title.edit : this.options.title.create;
}
return (this.context.edit) ? this.$t(this.default.title.edit) : this.$t(this.default.title.create);
return (this.context.edit) ? this.default.title.edit : this.default.title.create;
},
getTextButton() {
if ( typeof this.options.button.text !== 'undefined'

View File

@ -2,10 +2,6 @@ import { createApp } from 'vue'
import { store } from './store'
import App from './App.vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
import { addressMessages } from './i18n'
const i18n = _createI18n(addressMessages);
const app = createApp({
template: `<app></app>`,
})