From 537385e8f46b19b8b180af12ae44dcec75403c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Drunen?= Date: Sat, 16 Dec 2023 20:44:33 +0100 Subject: [PATCH] Translate SPA prototype --- package-lock.json | 5 ++ package.json | 1 + resources/assets/js/prototype/app.js | 11 ++++ .../assets/js/prototype/components/App.vue | 17 +++++- .../js/prototype/components/Navigation.vue | 4 +- .../js/prototype/screens/Activities.vue | 2 +- .../assets/js/prototype/screens/Dashboard.vue | 10 ++-- .../assets/js/prototype/screens/Login.vue | 10 ++-- .../screens/Settings/Preferences.vue | 10 ++-- .../prototype/screens/Transactions/Create.vue | 28 ++++----- .../prototype/screens/Transactions/Index.vue | 26 ++++---- .../assets/js/prototype/translations/en.json | 59 +++++++++++++++++++ .../assets/js/prototype/translations/index.js | 7 +++ .../assets/js/prototype/translations/nl.json | 59 +++++++++++++++++++ 14 files changed, 202 insertions(+), 47 deletions(-) create mode 100644 resources/assets/js/prototype/translations/en.json create mode 100644 resources/assets/js/prototype/translations/index.js create mode 100644 resources/assets/js/prototype/translations/nl.json diff --git a/package-lock.json b/package-lock.json index eb84679d..1478a299 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1130,6 +1130,11 @@ "tinycolor2": "^1.1.2" } }, + "vue-i18n": { + "version": "8.28.2", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.28.2.tgz", + "integrity": "sha512-C5GZjs1tYlAqjwymaaCPDjCyGo10ajUphiwA922jKt9n7KPpqR7oM1PCwYzhB/E7+nT3wfdG3oRre5raIT1rKA==" + }, "vue-loader": { "version": "17.2.2", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-17.2.2.tgz", diff --git a/package.json b/package.json index 1b5a4392..2b5fb98e 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "axios": "^1.6.0", "lucide-vue": "^0.292.0", "vue-color": "^2.7.0", + "vue-i18n": "^8.28.2", "vue-router": "3" } } diff --git a/resources/assets/js/prototype/app.js b/resources/assets/js/prototype/app.js index 3202b580..c336c189 100644 --- a/resources/assets/js/prototype/app.js +++ b/resources/assets/js/prototype/app.js @@ -1,7 +1,10 @@ import ApexCharts from 'apexcharts'; import Vue from 'vue'; +import VueI18n from 'vue-i18n' import VueRouter from 'vue-router'; +import translations from './translations'; + import App from './components/App.vue'; import Login from './screens/Login.vue'; @@ -15,6 +18,8 @@ window.ApexCharts = ApexCharts; Vue.prototype.versionNumber = window.versionNumber; +Vue.use(VueI18n); + Vue.use(VueRouter); const routes = [ @@ -45,6 +50,11 @@ const routes = [ }, ]; +const i18n = new VueI18n({ + locale: 'en', + messages: translations, +}); + const router = new VueRouter({ mode: 'history', routes, @@ -52,6 +62,7 @@ const router = new VueRouter({ new Vue({ el: '#app', + i18n, router, render: h => h(App), }); diff --git a/resources/assets/js/prototype/components/App.vue b/resources/assets/js/prototype/components/App.vue index 8274faaa..4303ff2e 100644 --- a/resources/assets/js/prototype/components/App.vue +++ b/resources/assets/js/prototype/components/App.vue @@ -1,4 +1,17 @@