<commit_before># Getting Started

```javascript
var Vue = require('vue')
var VueI18n = require('vue-i18n')

// ready translated locales
var locales = {
  en: {
    message: {
      hello: 'hello world'
    }
  },
  ja: {
    message: {
      hello: 'こんにちは、世界'
    }
  }
}

// install plugin
Vue.use(VueI18n)


// set lang
Vue.config.lang = 'ja'

// set locales
Object.keys(locales).forEach(function (lang) {
  Vue.locale(lang, locales[lang])
})

// create instance
new Vue({ el: 'body' })
```

Template the following:

```html
<p>{{ $t("message.hello") }}</p>
```

Output the following:

```html
<p>こんにちは、世界</p>
```<commit_msg>:pencil: docs(gitbook): add usage of '$t' by @KingMario<commit_after># Getting Started

```javascript
var Vue = require('vue')
var VueI18n = require('vue-i18n')

// ready translated locales
var locales = {
  en: {
    message: {
      hello: 'hello world'
    }
  },
  ja: {
    message: {
      hello: 'こんにちは、世界'
    }
  }
}

// install plugin
Vue.use(VueI18n)


// set lang
Vue.config.lang = 'ja'

// set locales
Object.keys(locales).forEach(function (lang) {
  Vue.locale(lang, locales[lang])
})

// create instance
new Vue({ el: 'body' })
```

Template the following:

```html
<p>{{ $t("message.hello") }}</p>
```

Output the following:

```html
<p>こんにちは、世界</p>
```

If you want to use `$t` in data property, methods or computed properties of a component, use `this.$t`:

```
export defaults {
  data () {
    return {
      hello: this.$t("message.hello")
    }
  },
  computed: {
    computedHello () {
      return this.$t("message.hello")
    }
  },
  methods: {
    sayHello () {
      alert(this.$t("message.hello"))
    }
  }
}
```
{'fraction_non_alphanumeric': 0.18753744757339724, 'fraction_numerical': 0.007189934092270821, 'mean_word_length': 3.0047961630695443, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6156104', 'n_tokens_mistral': 678, 'n_tokens_neox': 648, 'n_words': 148}