Skip to content

Instantly share code, notes, and snippets.

@madhurikulkarni madhurikulkarni/App.vue
Last active Apr 21, 2020

Embed
What would you like to do?
Multilanguage with a language-switcher in NativeScript Vue using vue-i18n
<Label @tap="$i18n.locale == 'de'" />
<Label text="EN" @tap="$i18n.locale == 'en'" />
Usage
<Label :text="$t('msg')" />
import Vue from 'vue';
import VueI18n from 'vue-i18n';
Vue.use(VueI18n);
const messages = {
'en': {
msg: "Hello World"
},
'de': {
msg: "Hallo Welt"
}
};
const i18n = new VueI18n({
locale: 'de', // set locale
fallbackLocale: 'de', // set fallback locale
messages
});
export default i18n;
import i18n from './plugins/i18n';
new Vue({
i18n,
render: h => h("frame", [h(App)])
}).$start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.