Skip to content

Internationalization

Tu View Plus components are using English by default, if you wish you use other languages, you can get you answer by keep reading.

Global configuration

Tu View Plus provides global configurations

typescript
import TuViewPlus from 'tu-view-plus'
import { enUs } from 'tu-view-plus/locale/index.mjs';

app.use(TuViewPlus, {
  locale: enUs,
})
import TuViewPlus from 'tu-view-plus'
import { enUs } from 'tu-view-plus/locale/index.mjs';

app.use(TuViewPlus, {
  locale: enUs,
})

ConfigProvider

Tu View Plus also provides a Vue component ConfigProvider for globally configuring locale and other settings.

html
<template>
  <tu-config-provider :locale="locale">
    <app />
  </tu-config-provider>
</template>

<script>
  import { defineComponent } from 'vue'
  import { TuConfigProvider } from 'tu-view-plus'
  import { enUs } from 'tu-view-plus/locale/index.mjs';

  export default defineComponent({
    components: {
      TuConfigProvider,
    },
    setup() {
      return {
        locale: enUs,
      }
    },
  })
</script>
<template>
  <tu-config-provider :locale="locale">
    <app />
  </tu-config-provider>
</template>

<script>
  import { defineComponent } from 'vue'
  import { TuConfigProvider } from 'tu-view-plus'
  import { enUs } from 'tu-view-plus/locale/index.mjs';

  export default defineComponent({
    components: {
      TuConfigProvider,
    },
    setup() {
      return {
        locale: enUs,
      }
    },
  })
</script>