Re: What is the proper way of markig translations of static array initializers
Alexander Shopov wrote: >> The context is stripped when the string is *used*, for >> marking it is irrelevant whether it has context or not, so >> mark it normally with N_(). > I am sorry but this does not work. > > When I mark strings simply with N_() the context information is not > stripped away - in fact the original string in English gets shown *with* > the context info - no translation gets shown even though the string is > translated. You need to mark the strings in the static initialiser using N_() only, and then when you actually *use* the strings, use Q_() to do the translation while stripping the context. So something like this should work: { static const char *stuff[] = { N_("Button label|I like strings"), N_("Menu label|This is another string"), NULL, }; int i; for(i = 0; stuff[i]; ++i) printf("Translated string is: %s\n", Q_(stuff[i])); } -brian ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: What is the proper way of markig translations of static array initializers
> The context is stripped when the string is *used*, for > marking it is irrelevant whether it has context or not, so > mark it normally with N_(). I am sorry but this does not work. When I mark strings simply with N_() the context information is not stripped away - in fact the original string in English gets shown *with* the context info - no translation gets shown even though the string is translated. When I mark the strings with Q_() or N_(Q_()) or Q_(N_()) I get such mistakes: gnomine.c:88: error: initializer element is not constant gnomine.c:88: error: (near initialization for ‘scorecats[0].name’) gnomine.c:90: error: initializer element is not constant gnomine.c:90: error: (near initialization for ‘scorecats[2].name’) gnomine.c:91: error: initializer element is not constant gnomine.c:91: error: (near initialization for ‘scorecats[3].name’) Any other ideas? Kind regards: al_shopov ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: What is the proper way of markig translations of static array initializers
On Sat, Feb 03, 2007 at 09:21:14AM +0200, Alexander Shopov wrote: > Hi guys, > The docs: > http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html > > state that > N_() > Marks a string for translation, gets replaced with the untranslated > string at runtime. This is useful in situations where the translated > strings can't be directly used, e.g. in string array initializers. > > How to add the addorning prefix in similar cases? (Like using Q_()). The context is stripped when the string is *used*, for marking it is irrelevant whether it has context or not, so mark it normally with N_(). Yeti -- Whatever. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
What is the proper way of markig translations of static array initializers
Hi guys, The docs: http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html state that N_() Marks a string for translation, gets replaced with the untranslated string at runtime. This is useful in situations where the translated strings can't be directly used, e.g. in string array initializers. How to add the addorning prefix in similar cases? (Like using Q_()). Kind regards: al_shopov ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list