Changes

Jump to navigation Jump to search

Supporting GUI Translation

734 bytes added, 16:33, 12 January 2012
→‎Mark translatable strings in the source code: Use a bit more technical terminology to explain the various translation related macros.
== Mark translatable strings in the source code ==
In order to make a string translatable you have to use one of the following pseudofunctions macros in your code:* ''_(const char *)'' -  Main  The simplest way to mark and substitute stringsat the same time. It's is not a functionconstant operation, i.e. it returns a translated version of the string and is might have side effects, thus it should not be used for strings within codestatic data tables. For the majority of translatable strings, this using ''_()'' is the function to suggested method. This can also be usedon variables, which contain strings marked for translation, and simply subsitutes the string then.* ''_c(const char *, const char *)'' - Another way to mark and substitute 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. This is not a constant operation either, so it should not be used for static data tables either. This can also be used on variables, which contain strings marked for translation, and simply subsitutes the string then.* ''_s(const char *)'' - A wrapper used to Only mark static a string constantsto be translated. This is a constant operation, like i.e. it also evaluates to the unchanged string. This is mainly used for example marking translatable strings in static arrays, which need to be translateddata tables. In 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(const char *, const char *)'' - Another way to only mark static string constantsstrings for translations. It attaches the string to a context so that we can have different translations for the same string. The second argument is the context. Subsitution should be performed via ''_c()'' later.* ''DECLARE_TRANSLATION_ADDITIONAL_CONTEXT(const char *, const char *)'' - Declare a string (first argument) to translate in a given context (second argument). This macro does not evaluate to any value.
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.
561

edits

Navigation menu