Skip to content

vue-i18n / general / Translation

Alias de Tipo: Translation()

ts
type Translation = () => object;

Componente de Traducción

Retorna

object

$props

ts
$props: VNodeProps & TranslationProps;

Comentarios

Vea los siguientes elementos para obtener detalles sobre las propiedades:

Ejemplo

html
<div id="app">
  <!-- ... -->
  <i18n keypath="term" tag="label" for="tos">
    <a :href="url" target="_blank">{{ $t('tos') }}</a>
  </i18n>
  <!-- ... -->
</div>
js
import { createApp } from 'vue'
import { createI18n } from 'vue-i18n'

const messages = {
  en: {
    tos: 'Term of Service',
    term: 'I accept xxx {0}.'
  },
  ja: {
    tos: '利用規約',
    term: '私は xxx の{0}に同意します。'
  }
}

const i18n = createI18n({
  locale: 'en',
  messages
})

const app = createApp({
  data: {
    url: '/term'
  }
}).use(i18n).mount('#app')

Vue I18n Component