Skip to content

Instantly share code, notes, and snippets.

@anselmobattisti
Created January 13, 2018 13:21
Show Gist options
  • Save anselmobattisti/bef967ce8a9ab8995fb32ded802c86c2 to your computer and use it in GitHub Desktop.
Save anselmobattisti/bef967ce8a9ab8995fb32ded802c86c2 to your computer and use it in GitHub Desktop.
in main.js
import VueI18n from 'vue-i18n'
import lang from './language/lang'
const i18n = new VueI18n({
locale: 'pt-BR', // set locale
messages: lang // set locale messages
}
new Vue({
el: '#app',
router,
template: '<App/>',
closeLoading: true,
i18n
})
in lang.js
import { ptBR } from './ptBR'
export default {
'pt-BR': ptBR
}
in ptbr.js
export const ptBR = {
general: {
loading: 'Aguarde, processando ... ',
construction: 'Obra',
message: 'Mensagem',
user: 'Usuário',
client: 'Cliente',
companiy: 'Empresa'
}
}
in your .vue file
<p>{{ $t("general.loading") }}</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment