Difference between revisions of "Supporting GUI Translation"

Jump to navigation Jump to search
Add an example to explain the difference between _() and _s()
(Add explanation about comments)
(Add an example to explain the difference between _() and _s())
Line 8: Line 8:
* ''_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).
An example to illustrate the difference between _() and _s():
_() is a function, and is used within code. So it's used in cases like this:
foo("Bar"); --> foo(_("Bar"));
_s() is a wrapper, used with static string constants. So it's used in cases like this:
char *foo {
  _s("bar"),
  _s("baz")
};


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.
1,489

edits

Navigation menu