Localization

Initialization
To localize VoicenterUI components set up localization in you application. To do this add the lang property when installing VoicenterUI plugin:

      import { createApp } from "vue"
      import VoicenterUI from "voicenter_ui"

      const app = createApp(App)
      app.use(VoicenterUI, {
        lang: "en"
      })
      
Set and get locale
To set locale and get the current one use locale property on $tVU global property:

      this.$tVU.locale = "en" // set locale
      console.log(this.$tVU.locale) // "en" - get current locale
      
Translate
To translate the text use $tVU.t function.

      this.$tVU.t("general.no.data") // returns "No Data"
      
To translate the text with parameters use $tVU.t function with the options object passed as a second parameter:

      this.$tVU.t("wizard.step.of", { current: 1, length: 3 }) // returns "Step 1 of 3"
      
The translation used above is declared in locales/en.json

      {
        "wizard.step.of": "Step {current} of {length}"
      }