Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active April 7, 2017 22:34
Show Gist options
  • Save ThomasG77/415ade3a505b7cf321528352032beecc to your computer and use it in GitHub Desktop.
Save ThomasG77/415ade3a505b7cf321528352032beecc to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vue-i18next demo</title>
<script src="https://rawgit.com/i18next/i18next/master/i18next.min.js"></script>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://rawgit.com/rse/vue-params/master/vue-params.js"></script>
<script src="https://rawgit.com/rse/vue-i18next/master/vue-i18next.js"></script>
</head>
<body>
<div id="sample">
{{ $t("foo")}}
{{ $t("bar.baz") }}
</div>
<script>
Vue.use(VueParams);
Vue.use(VueI18Next);
Vue.params.i18nextLanguage = "en";
var abc = i18next.init({
lng: Vue.params.i18nextLanguage,
resources: {
en: {
translation: {
"hello": "Hello world",
"foo": "foooooTBalllll",
"bar": {
"baz": "England"
}
}
},
de: {
translation: {
"hello": "Hallo Welt",
"foo": "fooooo",
"bar": {
"baz": "Germany"
}
}
}
}
});
// You can add i18nextNamespace key with the namespace you want.
// See doc at http://i18next.com/translate/namespace/
var vue = new Vue({
el: document.querySelector('#sample')
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment