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


Lokalise placeholders

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

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

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

[%key:key_name%]  Referenced key.

[%]  – 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.

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


Setting output placeholder format

As your placeholders are converted to Lokalise placeholders you can select which placeholder format to output them to. Some file formats only support the generic  implementation (e.g. Gettext), however some support various (e.g. JSON). You can select output placeholder format at the Downloads page (or use 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 for it's support for 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 that don't have a name, will be exported as placeholder_n where n is the positional index of the placeholder.


Did this answer your question?