Page heading do not translated on language change
Log in and log out of the application, change the language, and login
to the application. The heading and title are in the previous language
translation is handled in the router, and the languages are selected
after the router has rendered.The page title and heading translation
are handled after the language is selected.
Change-Id: Iba42fe3a535fe0b402f551c3f43e19d5ff12181d
Signed-off-by: Kirankumar Ballapalli <kirankumarb@ami.com>
diff --git a/src/components/Global/PageTitle.vue b/src/components/Global/PageTitle.vue
index 45c75ed..e195d1a 100644
--- a/src/components/Global/PageTitle.vue
+++ b/src/components/Global/PageTitle.vue
@@ -6,6 +6,7 @@
</template>
<script>
+import i18n from '@/i18n';
export default {
name: 'PageTitle',
props: {
@@ -19,6 +20,20 @@
title: this.$route.meta.title,
};
},
+ created() {
+ var title = this.$route.name;
+ var i = 1;
+ while (i < this.$route.name.split('-').length) {
+ var index = title.search('-');
+ title = title.replace(
+ '-' + title.charAt(index + 1),
+ title.charAt(index + 1).toUpperCase()
+ );
+ i++;
+ }
+ this.title = i18n.t('appPageTitle.' + title);
+ document.title = this.title;
+ },
};
</script>