Translates a given i18n-string with optional dynamic value-replacing.


Syntax

translate(string $i18nStr, array $params = null, string $lang = null) : string


Parameter

@param string $i18nStr The complete i18n-string. Translation needs to be defined in the main Textbaustein-Content-DB.

@param array|null $params Optional key-value-data (associative array) for dynamic replacing of %<vars>%

@param string|null $lang Optional iso-language code, e.g. "DE".


Return

Returns the translated string. If no translation was found an empty string is returned.


Examples

Simple standard

Looks up the configured translation stored under the i18n-key "my.DEMO.i18nStr" in the Hublify-Translation-DB.
It is translated into the render-environment's currently set "global language".

This is translated: "{{ hublify.translate('my.DEMO.i18nStr') }}"