Move translation into routes file

- Added intial application load document title update with
  created hook

Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I73d18ed4a56bd04601fa7382c2d6c2ec504b03f5
diff --git a/src/App.vue b/src/App.vue
index 30de752..b57a91d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -13,8 +13,11 @@
   name: 'App',
   watch: {
     $route: function(to) {
-      document.title = this.$t(to.meta.title) || 'Page is missing title';
+      document.title = to.meta.title || 'Page is missing title';
     }
+  },
+  created() {
+    document.title = this.$route.meta.title || 'Page is missing title';
   }
 };
 </script>
diff --git a/src/components/Global/PageTitle.vue b/src/components/Global/PageTitle.vue
index a77e0a0..e3dc8d0 100644
--- a/src/components/Global/PageTitle.vue
+++ b/src/components/Global/PageTitle.vue
@@ -16,7 +16,7 @@
   },
   data() {
     return {
-      title: this.$t(this.$route.meta.title)
+      title: this.$route.meta.title
     };
   }
 };
diff --git a/src/router/routes.js b/src/router/routes.js
index d187713..1a86510 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -25,9 +25,8 @@
 import SslCertificates from '@/views/AccessControl/SslCertificates';
 import Unauthorized from '@/views/Unauthorized';
 import VirtualMedia from '@/views/Control/VirtualMedia';
+import i18n from '@/i18n';
 
-// Meta title is translated using i18n in App.vue and PageTitle.Vue
-// Example meta: {title: 'appPageTitle.overview'}
 const routes = [
   {
     path: '/login',
@@ -38,7 +37,7 @@
         name: 'login',
         component: Login,
         meta: {
-          title: 'appPageTitle.login'
+          title: i18n.t('appPageTitle.login')
         }
       },
       {
@@ -46,7 +45,7 @@
         name: 'change-password',
         component: ChangePassword,
         meta: {
-          title: 'appPageTitle.changePassword',
+          title: i18n.t('appPageTitle.changePassword'),
           requiresAuth: true
         }
       }
@@ -64,7 +63,7 @@
         name: 'serial-over-lan-console',
         component: SerialOverLanConsole,
         meta: {
-          title: 'appPageTitle.serialOverLan'
+          title: i18n.t('appPageTitle.serialOverLan')
         }
       },
       {
@@ -72,7 +71,7 @@
         name: 'kvm-console',
         component: KvmConsole,
         meta: {
-          title: 'appPageTitle.kvm'
+          title: i18n.t('appPageTitle.kvm')
         }
       }
     ]
@@ -89,7 +88,7 @@
         name: 'overview',
         component: Overview,
         meta: {
-          title: 'appPageTitle.overview'
+          title: i18n.t('appPageTitle.overview')
         }
       },
       {
@@ -97,7 +96,7 @@
         name: 'profile-settings',
         component: ProfileSettings,
         meta: {
-          title: 'appPageTitle.profileSettings'
+          title: i18n.t('appPageTitle.profileSettings')
         }
       },
       {
@@ -105,7 +104,7 @@
         name: 'event-logs',
         component: EventLogs,
         meta: {
-          title: 'appPageTitle.eventLogs'
+          title: i18n.t('appPageTitle.eventLogs')
         }
       },
       {
@@ -113,7 +112,7 @@
         name: 'hardware-status',
         component: HardwareStatus,
         meta: {
-          title: 'appPageTitle.hardwareStatus'
+          title: i18n.t('appPageTitle.hardwareStatus')
         }
       },
       {
@@ -121,7 +120,7 @@
         name: 'sensors',
         component: Sensors,
         meta: {
-          title: 'appPageTitle.sensors'
+          title: i18n.t('appPageTitle.sensors')
         }
       },
       {
@@ -129,7 +128,7 @@
         name: 'ldap',
         component: Ldap,
         meta: {
-          title: 'appPageTitle.ldap'
+          title: i18n.t('appPageTitle.ldap')
         }
       },
       {
@@ -137,7 +136,7 @@
         name: 'local-users',
         component: LocalUserManagement,
         meta: {
-          title: 'appPageTitle.localUserManagement'
+          title: i18n.t('appPageTitle.localUserManagement')
         }
       },
       {
@@ -145,7 +144,7 @@
         name: 'ssl-certificates',
         component: SslCertificates,
         meta: {
-          title: 'appPageTitle.sslCertificates'
+          title: i18n.t('appPageTitle.sslCertificates')
         }
       },
       {
@@ -153,7 +152,7 @@
         name: 'date-time-settings',
         component: DateTimeSettings,
         meta: {
-          title: 'appPageTitle.dateTimeSettings'
+          title: i18n.t('appPageTitle.dateTimeSettings')
         }
       },
       {
@@ -161,7 +160,7 @@
         name: 'firmware',
         component: Firmware,
         meta: {
-          title: 'appPageTitle.firmware'
+          title: i18n.t('appPageTitle.firmware')
         }
       },
       {
@@ -169,7 +168,7 @@
         name: 'kvm',
         component: Kvm,
         meta: {
-          title: 'appPageTitle.kvm'
+          title: i18n.t('appPageTitle.kvm')
         }
       },
       {
@@ -177,7 +176,7 @@
         name: 'manage-power-usage',
         component: ManagePowerUsage,
         meta: {
-          title: 'appPageTitle.managePowerUsage'
+          title: i18n.t('appPageTitle.managePowerUsage')
         }
       },
       {
@@ -185,7 +184,7 @@
         name: 'network-settings',
         component: NetworkSettings,
         meta: {
-          title: 'appPageTitle.networkSettings'
+          title: i18n.t('appPageTitle.networkSettings')
         }
       },
       {
@@ -193,7 +192,7 @@
         name: 'reboot-bmc',
         component: RebootBmc,
         meta: {
-          title: 'appPageTitle.rebootBmc'
+          title: i18n.t('appPageTitle.rebootBmc')
         }
       },
       {
@@ -201,7 +200,7 @@
         name: 'server-led',
         component: ServerLed,
         meta: {
-          title: 'appPageTitle.serverLed'
+          title: i18n.t('appPageTitle.serverLed')
         }
       },
       {
@@ -209,7 +208,7 @@
         name: 'serial-over-lan',
         component: SerialOverLan,
         meta: {
-          title: 'appPageTitle.serialOverLan'
+          title: i18n.t('appPageTitle.serialOverLan')
         }
       },
       {
@@ -217,7 +216,7 @@
         name: 'server-power-operations',
         component: ServerPowerOperations,
         meta: {
-          title: 'appPageTitle.serverPowerOperations'
+          title: i18n.t('appPageTitle.serverPowerOperations')
         }
       },
       {
@@ -225,7 +224,7 @@
         name: 'virtual-media',
         component: VirtualMedia,
         meta: {
-          title: 'appPageTitle.virtualMedia'
+          title: i18n.t('appPageTitle.virtualMedia')
         }
       },
       {
@@ -233,7 +232,7 @@
         name: 'unauthorized',
         component: Unauthorized,
         meta: {
-          title: 'appPageTitle.unauthorized'
+          title: i18n.t('appPageTitle.unauthorized')
         }
       },
       {
@@ -241,7 +240,7 @@
         name: 'page-not-found',
         component: PageNotFound,
         meta: {
-          title: 'appPageTitle.pageNotFound'
+          title: i18n.t('appPageTitle.pageNotFound')
         }
       }
     ]