# Localization

{% hint style="info" %}
This feature is only available on DocKing **v1.4.0 and above**.
{% endhint %}

In case you need to deliver your PDF in multilingual, worry no more. DocKing is finally supporting that 😎

DocKing's Localization is built on top of Laravel Localization, meaning you can use every feature/helper/... from Laravel's Localization.

Learn more about Laravel Localization: <https://laravel.com/docs/10.x/localization#retrieving-translation-strings>

### Glossary

* Languages: languages that you want to use from your applications (for example, I want English & Vietnamese, I'll create 2 languages)
* Translation Groups: for grouping the translation texts
  * E.g.: Base Group, Invoicing Group, etc.
  * **Note:** if you **delete** a Translation Group, the associated Translations will be deleted as well.
* Translations: holding the translation texts

### Console UI

You can manage Languages, Translation Groups & Translations in the Console UI.

{% tabs %}
{% tab title="Menu" %}
![](https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2FULeW6P0vokcZHHv9L0Wu%2Fimage.png?alt=media\&token=79c92de2-e0d4-4419-a15d-2dc65ca1ca1d)
{% endtab %}

{% tab title="Languages" %}

<figure><img src="https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2F0PdwQ3Li02fJhKNzvpHF%2Fimage.png?alt=media&#x26;token=a0a23fcd-4053-4441-adbe-3e0a1dcadb56" alt=""><figcaption><p>Listing</p></figcaption></figure>

<figure><img src="https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2FJtsPF0dQqalPOupat69W%2Fimage.png?alt=media&#x26;token=590ee725-3872-4415-931f-b70a977cc702" alt=""><figcaption><p>Create</p></figcaption></figure>
{% endtab %}

{% tab title="Translation Groups" %}

<figure><img src="https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2FjaNtHlML0cuPbAPnje0Y%2Fimage.png?alt=media&#x26;token=70dfafce-53cc-46be-af77-ce6450ae52ef" alt=""><figcaption><p>Listing</p></figcaption></figure>
{% endtab %}

{% tab title="Translations" %}

<figure><img src="https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2FJCUcCiLMsWPPvfun1fqH%2Fimage.png?alt=media&#x26;token=ad9246f9-9ce1-4e4d-a8cc-7645684fda50" alt=""><figcaption><p>Listing</p></figcaption></figure>

<figure><img src="https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2FV2OwTVwxGClWBPHefDrA%2Fimage.png?alt=media&#x26;token=699883d5-f6f4-48b0-aeb7-c36de18f9017" alt=""><figcaption><p>Create/Edit Translation</p></figcaption></figure>
{% endtab %}
{% endtabs %}

### Get the translated texts in Templates

In your Document Templates, you would be able to use these functions to get the translation:

```
@lang('key')
{{ __('key') }}
{{ trans('key') }}
```

For example: this is my template with some translations.

<figure><img src="https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2FrsgpseXRTro84pRro4x9%2Fimage.png?alt=media&#x26;token=a797f550-93e8-464b-b173-c985c0d3e348" alt=""><figcaption></figcaption></figure>

Hitting "Preview", I'll able to see the rendered version.

<figure><img src="https://4001454994-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F35WpFfbPjsx7AT7mEjwk%2Fuploads%2FSkwv2ABZrmOW78GJwUCM%2Fimage.png?alt=media&#x26;token=05838bc2-0ad9-410e-a668-6cea83cb1b80" alt=""><figcaption></figcaption></figure>

### Render PDF metadata

From [#post-v1-document-templates-uuid-pdfs](https://docking.shipsaas.tech/usage/endpoints#post-v1-document-templates-uuid-pdfs "mention") and [#post-v1-document-templates-uuid-pdfs-async](https://docking.shipsaas.tech/usage/endpoints#post-v1-document-templates-uuid-pdfs-async "mention") endpoints, you can specify the `language` in the `metadata` object

```
POST api/v1/document-templates/{uuid}/pdfs
metadata: {
  "language": "en" // or vi, es,...
}
```

And that's all :wink:
