-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added multi-language support via i18n #182
Conversation
vue/src/router/index.js
Outdated
beforeEnter(to,from,next){ | ||
const lang = to.params.lang; | ||
//redirect to empty /en page | ||
//TODO replace '/en' with usefull language info or 404 page |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove TODO before creating pull requests
vue/src/router/index.js
Outdated
mode: 'history', | ||
base: process.env.BASE_URL, | ||
routes: [{ | ||
//check for language prefix (i.e /en/ or /de/). Default to /en/ if no valid prefix was found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No language prefixes needed
We use local variable (kazupon/vue-i18n#2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good approach, we have decided to use a reactive language state instead of .../de/, .../en/.
Please check this issue out: kazupon/vue-i18n#2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
(eg. "midnightboard/de/about")
Using localized i18n strings
Localized Strings have to be added to
vue/src/lang/translations/en.json
and/de.json
respectively.To reference a localized string, use the $t parameter, eg.
<p> {{ $t('helloWorld' ) }} </p>