We recommend storing all platform keys in the same project to avoid duplicate translations. As each platform requires specific placeholders, we will replace them with Lokalise universal placeholders upon upload. If you are adding keys manually in the editor, be sure to use Lokalise placeholders according to the table below.


Universal placeholders

[%s], [%1$s], [%s:name]  – String.

[%i], [%1$i], [%i:name]  – Integer.

[%f], [%.2f], [%1$.2f], [%.2f:name]  – Float.

:name is only used in placeholder formats that support named placeholders, and will be ignored for other formats.

Reference placeholder

[%key_id:key_id%]  Referenced key.

Special placeholders

[%]  – Will be automatically exported as %%  for printf and iOS placeholder formats if the string contains at least one placeholder (will be exported as %  otherwise).

[VOID]  – Exported as empty string, but counts as translated in the system.

[TRUE], [FALSE] – Exported as boolean.

Note that [VOID], [TRUE], [FALSE] should be the only text in a given translation, e.g. This sentence is [FALSE] is incorrect usage of the [FALSE] placeholder and will be simply exported as text.


Setting output placeholder format

As your placeholders are converted to Lokalise placeholders you can select their output placeholder format. Some file formats only support generic implementation (e.g. Gettext), however some support various types (e.g. JSON). You can select the output placeholder format on the Downloads page (or use the placeholder_format API/CLI parameter.


Placeholder formats

Example string – My name is [%s:name]. I have [%.2f] dollars.

printf

Printf-style placeholders – My name is %s. I have %.2f dollars. 

%i is converted to %d. Other variants remain unchanged.

ios

iOS-style placeholders – My name is %@. I have %.2f dollars. 

%s is converted to %@ and %i is converted to %li (%li  is used to support both 32 and 64 bit integers). Other variants remain unchanged.

icu

ICU Message Format placeholders – My name is {name}. I have {0} dollars. 

Placeholders that have a name, will be exported as {name}, other placeholders will be exported as {n} where n is the positional index of the placeholder. When used in ICU plurals, the placeholder with positional index of 1 will be exported as #.

net

.NET placeholder format – My name is {0}. I have {0:0.00} dollars.

symfony

Symfony placeholder format – My name is %name%. I have %placeholder_1% dollars. 

Placeholders without a name, will be exported as exported as placeholder_n where n is the positional index of the placeholder.


Did this answer your question?