Links
Comment on page

Localization

[v1.4.0+] Localization for your rendered PDF files
This feature is only available on DocKing v1.4.0 and above.
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.

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.
Menu
Languages
Translation Groups
Translations
Listing
Create
Listing
Listing
Create/Edit Translation

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.
Hitting "Preview", I'll able to see the rendered version.

Render PDF metadata

From post-v1-document-templates-uuid-pdfs and post-v1-document-templates-uuid-pdfs-async 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
😉