use messages in template & add automatic page titling from route name

This commit is contained in:
axolotle
2021-03-10 15:26:44 +01:00
parent fb0c99e444
commit 965112ddbb
5 changed files with 13 additions and 26 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>En Françai(s)</title> <title>En françaiS au pluriel</title>
</head> </head>
<body> <body>
<noscript> <noscript>
+11 -13
View File
@@ -3,7 +3,7 @@
<header> <header>
<b-navbar toggleable="md"> <b-navbar toggleable="md">
<b-navbar-brand :to="{ name: 'home' }"> <b-navbar-brand :to="{ name: 'home' }">
En Français {{ $t('title') }}
</b-navbar-brand> </b-navbar-brand>
<b-navbar-toggle target="nav-collapse" /> <b-navbar-toggle target="nav-collapse" />
@@ -11,13 +11,13 @@
<b-collapse id="nav-collapse" is-nav> <b-collapse id="nav-collapse" is-nav>
<b-navbar-nav class="ml-auto"> <b-navbar-nav class="ml-auto">
<b-nav-item :to="{ name: 'library' }"> <b-nav-item :to="{ name: 'library' }">
Bibliothèque {{ $t('sections.library') }}
</b-nav-item> </b-nav-item>
<b-nav-item :to="{ name: 'kit' }"> <b-nav-item :to="{ name: 'kit' }">
Kit de désapprentissage {{ $t('sections.kit') }}
</b-nav-item> </b-nav-item>
<b-nav-item :to="{ name: 'gallery' }"> <b-nav-item :to="{ name: 'gallery' }">
Créations numériques {{ $t('sections.gallery') }}
</b-nav-item> </b-nav-item>
</b-navbar-nav> </b-navbar-nav>
</b-collapse> </b-collapse>
@@ -36,15 +36,13 @@
export default { export default {
name: 'App', name: 'App',
metaInfo: { metaInfo () {
// if no subcomponents specify a metaInfo.title, this title will be used return {
title: 'Home', // if no subcomponents specify a metaInfo.title, try to get one from the route name.
// all titles will be injected into this template title: this.$t('sections.' + this.$route.name, ''),
titleTemplate: '%s | En Français', // all titles will be injected into this template
meta: [ titleTemplate: '%s | ' + this.$t('title')
{ charset: 'utf-8' }, }
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
]
} }
} }
</script> </script>
+1 -1
View File
@@ -42,7 +42,7 @@
v-if="text.bounces" v-if="text.bounces"
:id="'bounces-' + text.id" :id="'bounces-' + text.id"
> >
Textes rebonds {{ $t('bounce_texts') }}
</b-button> </b-button>
<b-popover <b-popover
v-if="text.bounces" v-if="text.bounces"
-1
View File
@@ -2,7 +2,6 @@ import messages from './fr.json'
function getMessage (keyedPath, alt) { function getMessage (keyedPath, alt) {
console.log(keyedPath, alt)
let message let message
try { try {
message = keyedPath.split('.').reduce((parent, key) => { message = keyedPath.split('.').reduce((parent, key) => {
-10
View File
@@ -32,16 +32,6 @@ export default {
TextCard TextCard
}, },
metaInfo () {
return {
title: this.groups.length ? 'Bibliothèque - ' + this.groups[0].id : 'Bibliothèque',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
]
}
},
props: { props: {
mode: { type: String, required: true }, mode: { type: String, required: true },
texts: { type: Array, required: true } texts: { type: Array, required: true }