From 86e6bba58fb60754c16b1d00459ca6f781d27d5b Mon Sep 17 00:00:00 2001 From: Sadiq Khoja Date: Fri, 26 Jul 2024 16:38:27 -0400 Subject: [PATCH] install vue-i18n and use translation API for static text --- packages/web-forms/package.json | 4 +- packages/web-forms/src/WebFormsPlugin.ts | 6 + .../web-forms/src/components/FormHeader.vue | 28 ++- packages/web-forms/vite.config.ts | 3 +- yarn.lock | 210 +++++++++++++++++- 5 files changed, 229 insertions(+), 22 deletions(-) diff --git a/packages/web-forms/package.json b/packages/web-forms/package.json index 15d33c0ed..3a419e409 100644 --- a/packages/web-forms/package.json +++ b/packages/web-forms/package.json @@ -64,7 +64,9 @@ "vite": "^5.3.3", "vite-plugin-css-injected-by-js": "^3.5.1", "vitest": "^2.0.2", - "vue": "3.3.4" + "vue": "3.3.4", + "vue-i18n": "^9.13.1", + "@intlify/unplugin-vue-i18n": "^4.0.0" }, "peerDependencies": { "vue": "^3.3.4" diff --git a/packages/web-forms/src/WebFormsPlugin.ts b/packages/web-forms/src/WebFormsPlugin.ts index 0bb448f05..3e7e072ec 100644 --- a/packages/web-forms/src/WebFormsPlugin.ts +++ b/packages/web-forms/src/WebFormsPlugin.ts @@ -1,8 +1,14 @@ import PrimeVue from 'primevue/config'; import { type App } from 'vue'; +import { createI18n } from 'vue-i18n'; + +const i18n = createI18n({ + locale: 'en' +}); export const webFormsPlugin = { install(app: App) { app.use(PrimeVue, { ripple: false }); // Collect has no ripple + app.use(i18n); }, }; diff --git a/packages/web-forms/src/components/FormHeader.vue b/packages/web-forms/src/components/FormHeader.vue index da2c467a4..dde6f114c 100644 --- a/packages/web-forms/src/components/FormHeader.vue +++ b/packages/web-forms/src/components/FormHeader.vue @@ -1,10 +1,13 @@