Soluling home   Document home

Hidden Id Injection

This is a feature that injects hidden ids for each localized string. It can be used to trace back a localized string from an application to a specific row in the Soluling project. The id is injected at the end of the translation and written using zero-width Unicode characters. A zero-width Unicode character is a special character that does not render. This means that the extra characters do not render, making the strings to look exactly like the normally translated strings. However, if your application uses some runtime code to mark or trace translations, you can easily extract the id from the translated string and then find the row where the translation comes from. To do that, you have to write some code to decode the id. The following paragraph explains the encoding algorithm.

Each row in Soluling has a unique context. The context is a combination of elements where the row belongs and the row id. These context ids are descriptive, but they are also quite long. It would be impractical to inject that in the translations. Instead, Soluling uses integer ids. Every row has a unique id that does not ever change. The id is like the primary key in a database. The first row gets 1, the second row 2, etc. This id is used when injecting ids. Soluling uses four different zero wide Unicode characters to encode the ids. These four characters can be any combination of the following characters:

Name Hex Decimal UTF-8 HTML Default
Zero width space 200B 8203 E2808B
Zero width non joiner 200C 8204 E2808C ‌ yes
Zero width joiner 200D 8205 E2808D ‍ yes
Left to right mark 200E 8206 E2808E ‎
Left to right embedding 202A 8234 E280AA
Pop directional formatting 202C 8236 E280AC yes
Left to right overwrite 202D 8237 E280AD yes
Word joiner 2060 8288 E281A0
Invisible times 2062 8290 E281A2
Invisible separator 2063 8291 E281A3
Zero width no-break space FEFF 65279 EFBBBF

The default characters (Zero width non joiner, Zero width joiner, Pop directional formatting, and Left to right overwrite) works with most desktop, mobile, and web applications. However, you might have some troubles with certain zero-width characters. For example, some of them may actually render, or they might cause some other issues. If this is the case, try to select a different set of four characters.

Each digit of the id is coded as hex using two zero width characters. The following table contains the combinations:

Digit Code point
0 char1 + char1
1 char1 + char2
2 char1 + char3
3 char1 + char4
4 char2 + char1
5 char2 + char2
6 char2 + char3
7 char2 + char4
8 char3 + char1
9 char3 + char2
A char3 + char3
B char3 + char4
C char4 + char1
D char4 + char2
E char4 + char3
F char4 + char4

char1 is the first checked character, char2 is the second, etc.

For example, if your translation is "Auto" and the row id of the rows is 183, that is 0xB7 as hex. Then the following translation is generated.

"Auto" + char3 + char4 + char2 + char4

If you use the default zero-width characters, the string will be

"Auto" + U+202C + U+2060 + U+200D + U+2060

How to inject ids

By default, Soluling does not inject hidden ids. If you want to use them, you have to turn the feature on. Use the project build options. If you use SoluMake you can also use -injectid option.

SoluMake build -injectid MyProject.ntp

Reference code

You can find the following reference code to encode and decode ids and to parse translations:

Programming language Source code
C# <data-dir>\Library\NET\Standard\HiddenId.cs
Delphi <data-dir>\Library\Delphi\NtHiddenId.pas
JavaScript <data-dir>\Library\JavaScript\HiddenId.js
TypeScript <data-dir>\Library\TypeScript\HiddenId.ts

To see how to use the API read the source code.

Note! Hidden id injection is only enabled if you have a Soluling edition that supports it, such as Enterprise edition.