1,502
edits
m (Layout) |
(Removed the extra code fragments for _() and _s() and updated the text describing their usage) |
||
Line 3: | Line 3: | ||
== Mark translatable strings in the source code == | == Mark translatable strings in the source code == | ||
In order to make a string translatable you have to use one of the following pseudofunctions in your code: | In order to make a string translatable you have to use one of the following pseudofunctions in your code: | ||
* ''_(char *)'' - Main way to mark strings. | * ''_(char *)'' - Main way to mark strings. It's a function, and is used for strings within code. For the majority of translatable strings, this is the function to be used. | ||
* ''_c(char *, char *)'' - Another way to mark strings. It attaches the string to a context so that we can have different translations for the same string. The second argument is the context. | * ''_c(char *, char *)'' - Another way to mark strings. It attaches the string to a context so that we can have different translations for the same string. The second argument is the context. | ||
* ''_s(char *)'' - | * ''_s(char *)'' - A wrapper used to mark static string constants, like for example static arrays, which need to be translated. In this case you mark these strings with _s(), and then use ''_()'' or ''_c()'' at the place where you need to perform the substitution. | ||
* ''_sc(char *, char *)'' - Another way to mark static string constants. It attaches the string to a context so that we can have different translations for the same string. The second argument is the context. | * ''_sc(char *, char *)'' - Another way to mark static string constants. It attaches the string to a context so that we can have different translations for the same string. The second argument is the context. | ||
* ''DECLARE_TRANSLATION_ADDITIONAL_CONTEXT(char *, char *)'' - Declare a string (first argument) to translate in a given context (second argument). | * ''DECLARE_TRANSLATION_ADDITIONAL_CONTEXT(char *, char *)'' - Declare a string (first argument) to translate in a given context (second argument). | ||
If you want to give some additional explanations to the translators, or your string could be understood in a different ways, it is recommended to precede it with a comment tagged I18N. | If you want to give some additional explanations to the translators, or your string could be understood in a different ways, it is recommended to precede it with a comment tagged I18N. |
edits