Open main menu

Difference between revisions of "Supporting GUI Translation"

Add explanation about comments
m (behaviour -> behavior)
(Add explanation about comments)
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).
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.
<syntax type="C++">
<syntax type="C++">
// I18N: This is explanation to the line below and will be included in .pot and .po files
static const char *foo = _s("Some translatable text");
static const char *foo = _s("Some translatable text");
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Some translatable text", "lowres")
DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Some translatable text", "lowres")
Line 16: Line 20:


StaticTextWidget *path = new StaticTextWidget(this, "name", _("None", "path"));
StaticTextWidget *path = new StaticTextWidget(this, "name", _("None", "path"));
// I18N: Some more explanations for the translators
StaticTextWidget *soundfont = new StaticTextWidget(this, "name", _("None", "soundfont"));
StaticTextWidget *soundfont = new StaticTextWidget(this, "name", _("None", "soundfont"));
</syntax>
</syntax>