diff --git a/README.md b/README.md index d10f893..dfa15ca 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,6 @@ git subtree pull --prefix assets/vue https://github.com/valantic/vue-template.gi . |- setup Configuration and setup of the application . |- stores Pinia stores . |- styleguide Assets, components, mock data and routes for the stylguide -. |- translations Translations for the application |- blueprints File blueprints |- (dist) Build folder |- (node_modules) Node modules used by this project @@ -602,48 +601,6 @@ In cases where HTML is pre-rendered by twig, slots can be used to give the HTML ``` -## Translations - -All text which is defined in frontend MUST be placed trough translations. There should NOT be any hard coded inline text in the component templates or JavaScript. - -### Plugin - -We use the [vue-i18n](https://github.com/kazupon/vue-i18n) plugin to handle translations. This tool also allows us to handle localizations (e.g. number or date formats). The documentation can be found [here](https://kazupon.github.io/vue-i18n/guide/started.html). - -We discovered that the provided directive `v-t` accelerates the memory leak issue in IE11 since it creates copies of the translation JSON for each use (as of v8.15.3). For this reason, please use the `{{$t()}}` method. - -### Keys - -Translations should be marked with a specific translation key. Don't use English text as ab identifier key, since it might interfere with other uses in the application or can simply have different meanings in other languages, that need to be distinguished. - -The key should always be namespaced with the components name. E.g. `c-component.specificKey` - -```js -// Bad -this.$t('Some translateable text.'); - -// Good -this.$t('e-button.defaultLabel'); -``` - -### Placeholders - -vue-i18n allows the usage of [placeholders](https://kazupon.github.io/vue-i18n/guide/formatting.html#named-formatting). This means you should add dynamic parts with a placeholder to the translation and not concatenate them in the component template or JavaScript. - -### Pluralization - -Be aware that [vue-i18n](https://github.com/kazupon/vue-i18n) also supports a [pluralization](https://kazupon.github.io/vue-i18n/guide/pluralization.html) syntax. So you should not define multiple translations and then switch them in templates. - -### Use outside of component or Vue instance - -If you need to use translations outside of a component or Vue instance, where the utilities are injected, you can use the vue-i18n instance which is exported from `setup/i18n.js`. - -```javascript -import { i18n } from '@/setup/i18n'; - -const translation = i18n.global.t('c-add-to-cart.notLoggedInTitle'); -``` - ## Blueprints In the `/blueprints` folder you'll find templates for several tasks like a new component, test or styleguide entry. Please always base new files on this blueprints and not on an empty or copied existing file. diff --git a/package-lock.json b/package-lock.json index eeff8e3..711e7e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,7 @@ "body-scroll-lock": "~4.0.0-beta.0", "the-new-css-reset": "~1.11.3", "vite": "~6.2.0", - "vue": "~3.5.13", - "vue-i18n": "~11.1.1" + "vue": "~3.5.13" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "~4.3.0", @@ -794,47 +793,6 @@ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, - "node_modules/@intlify/core-base": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-11.1.1.tgz", - "integrity": "sha512-bb8gZvoeKExCI2r/NVCK9E4YyOkvYGaSCPxVZe8T0jz8aX+dHEOZWxK06Z/Y9mWRkJfBiCH4aOhDF1yr1t5J8Q==", - "dependencies": { - "@intlify/message-compiler": "11.1.1", - "@intlify/shared": "11.1.1" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/message-compiler": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-11.1.1.tgz", - "integrity": "sha512-4iEsUZ3aF7jXY19CJFN5VP+pPyLITD9FVsjB13z9TU1UxaZLlFsmNhvRxlPDSOfHAP5RpNF2QKKdZ3DHVf4Yzw==", - "dependencies": { - "@intlify/shared": "11.1.1", - "source-map-js": "^1.0.2" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, - "node_modules/@intlify/shared": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-11.1.1.tgz", - "integrity": "sha512-2kGiWoXaeV8HZlhU/Nml12oTbhv7j2ufsJ5vQaa0VTjzUmZVdd/nmKFRAOJ/FtjO90Qba5AnZDwsrY7ZND5udA==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", @@ -2437,6 +2395,7 @@ "version": "6.6.4", "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.4.tgz", "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==", + "dev": true, "license": "MIT" }, "node_modules/@vue/eslint-config-typescript": { @@ -8642,25 +8601,6 @@ "dev": true, "license": "ISC" }, - "node_modules/vue-i18n": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-11.1.1.tgz", - "integrity": "sha512-0P6DkKy96R4Wh2sIZJEHw8ivnlD1pnB6Ib/eldoF1SUpQutfKZv6aMqZwICS1gW0rwq24ZSXw7y3jW+PRVYqWA==", - "dependencies": { - "@intlify/core-base": "11.1.1", - "@intlify/shared": "11.1.1", - "@vue/devtools-api": "^6.5.0" - }, - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://github.com/sponsors/kazupon" - }, - "peerDependencies": { - "vue": "^3.0.0" - } - }, "node_modules/vue-router": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.5.0.tgz", diff --git a/package.json b/package.json index aaad19d..bf8782c 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,7 @@ "body-scroll-lock": "~4.0.0-beta.0", "the-new-css-reset": "~1.11.3", "vite": "~6.2.0", - "vue": "~3.5.13", - "vue-i18n": "~11.1.1" + "vue": "~3.5.13" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "~4.3.0", diff --git a/package.md b/package.md index 91ca331..5a1e5a0 100644 --- a/package.md +++ b/package.md @@ -68,8 +68,6 @@ This will test the current state of TS, JS and CSS code. Tests **MUST** be execu > core, css - [vue](https://www.npmjs.com/package/vue) - Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web. > core, cue -- [vue-i18n](https://www.npmjs.com/package/vue-i18n) - Internationalization plugin for Vue.js - > core, vue ## Dev-Dependencies diff --git a/src/components/c-vas-language.vue b/src/components/c-vas-language.vue index 7d78f16..7be1f5a 100644 --- a/src/components/c-vas-language.vue +++ b/src/components/c-vas-language.vue @@ -4,21 +4,18 @@ diff --git a/src/components/c-vas-sidebar.vue b/src/components/c-vas-sidebar.vue index ca14054..f24a7f5 100644 --- a/src/components/c-vas-sidebar.vue +++ b/src/components/c-vas-sidebar.vue @@ -59,7 +59,10 @@ @@ -107,6 +110,7 @@ emits: { 'updateTheme': (theme: string) => typeof theme === 'string', + 'updateLanguage': (language: string) => typeof language === 'string', }, setup(): Setup { return { @@ -163,6 +167,10 @@ this.$emit('updateTheme', theme); }, + onUpdateLanguage(language: string) { + this.$emit('updateLanguage', language); + }, + /** * Hides the overlay if the user clicks somewhere else than inside the container. */ diff --git a/src/components/c-vas-theme-selector.vue b/src/components/c-vas-theme-selector.vue index 61d0aa4..6b81b46 100644 --- a/src/components/c-vas-theme-selector.vue +++ b/src/components/c-vas-theme-selector.vue @@ -69,7 +69,7 @@ }, set(value: string) { // TODO: we need to set the theme. - console.log('set: ', value); + console.log('set: ', value); /* eslint-disable-line no-console */ }, }, diff --git a/src/elements/e-vas-multiselect.vue b/src/elements/e-vas-multiselect.vue index 20c7521..44586a4 100644 --- a/src/elements/e-vas-multiselect.vue +++ b/src/elements/e-vas-multiselect.vue @@ -5,7 +5,6 @@ v-if="isOpen && hasSearch" v-model="searchTerm" ref="searchField" - :placeholder="$t('e-multiselect.searchFieldPlaceholder')" :class="b('search-field')" type="text" @mouseenter="hover = true" @@ -59,7 +58,6 @@