Skip to content
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

Merged
merged 3 commits into from
Jan 25, 2020
Merged

Conversation

MistereoSC
Copy link
Contributor

  • Added provisional 404 page.
  • Added i18n support for english and german
  • Routes changed to require language parameter. Parameter consists of 2 letter language code.
    (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.

//  ../lang/translations/de.json
{
  "helloWorld" : "Hallo Welt!"
  "anotherMessage" : "Noch eine Nachricht!"
}

To reference a localized string, use the $t parameter, eg.
<p> {{ $t('helloWorld' ) }} </p>

beforeEnter(to,from,next){
const lang = to.params.lang;
//redirect to empty /en page
//TODO replace '/en' with usefull language info or 404 page
Copy link
Contributor

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

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
Copy link
Contributor

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)

Copy link
Contributor

@DevPhilB DevPhilB left a 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

Copy link
Contributor

@DevPhilB DevPhilB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@MistereoSC MistereoSC merged commit 6189937 into development Jan 25, 2020
@MistereoSC MistereoSC deleted the feature/i18n-104 branch January 25, 2020 15:55
@Simon-Deuring Simon-Deuring added this to the Milestone I milestone Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants