Skip to main content
Version: 4.x.x

Tolgee wrapping

Tolgee offers two ways of wrapping, you can configure this through wrapperMode.

Text wrapping

In development mode Tolgee wraps every key and it's params into a specific format unless noWrap parameter is true.

<inputPrefix><translationKey>,[<defaultValue>]:[<param1>:<value1>,...,,<paramN>:<valueN>]<inputSuffix>

For example:

tolgee.instant("peter_has_n_dogs", {dogsCount: "5"});

returns:

%-%tolgee:peter_has_n_dogs:dogsCount:5%-%

when inputPrefix and inputSuffix configuration properties are default.

Tolgee is then able to find this wrapped string in DOM and replace it with Peter has 5 dogs. It also stores its metadata in suitable parent element and makes it clickable to allow in-context localization.

Invisible wrapping

Since version 3.0 we introduced invisible wrapping, which uses unicode zero width characters. This method is intended only for framework integrations and basically just adds a invisible mark to each translation, which is then picked up and translation is registered in parent element, so in-context can work properly (blog post). This only applies to development mode. In production mode no special characters are added.