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.

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.

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

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

And that's all 😉

Last updated