docs/pages/getting-started/internationalization/doc.md

Summary

Maintainability
Test Coverage
---
title: Internationalization
description: Translate your components
order: 30
---

### How it work

Murmur can be translated using [vue-i18n](https://github.com/kazupon/vue-i18n).
By default, we provide a series of locales in English for our components. The
translation library is installed at a component level. So each component using
translation received a `i18n` attribute.

### Adding more locales

Murmur exposes a static method to add new locales:

```js
import Murmur from '@icij/murmur'

Murmur.setLocaleMessage('fr', {
  "imddb-header": {
    "navbar": {
      "leak": "Contact confidentiel",
      "support": "Soutenez nous",
      "follow": "Suivez l'ICIJ"
    }
  }
})
```

Then you can switch to a new language easily:

```js
Murmur.setLocale('fr')
```

### Overiding locales

In the very same fashion, you can modify existing locales:

```js
import Murmur from '@icij/murmur'

Murmur.mergeLocaleMessage('en', {
  "imddb-header": {
    "navbar": {
      "leak": "SecureDrop",
      "support": "Buy us a beer 🍺",
      "follow": "Follow ICIJ"
    }
  }
})
```

### Default locales

Here are English locales defined in <repository-link path="lib/locales/en.json">lib/locales/en.json</repository-link>:

<collapsible-block label="All English locales">
  <pre class="bg-dark p-3 m-0"><code>{{ JSON.stringify(en, null, 2) }}</code></pre>
</collapsible-block>

<script>
  import en from '@/locales/en.json'

  export default {
    data () {
      return {
        en
      }
    }
  }
</script>