Problems with translations - N_() and Q_()
Hi!
I wanted to bring your attention to some internationalization issues I came across when fixing various bugs. I hope some clarification can be made so that we can avoid further problems.
1.) Using the N_ macro
The N_ macro is used to mark strings as being translatable but does not translate them. It has to be used when strings can't be directly translated (most common in the string array initializers). So whenever N_ is added in the code - it needs another call to _() later in the code to actually perform the translation. There have been some circumstances before where this second call was missing and I will try and track if there are any more.
Please note that I don't think the N_ macro cannot be simply substituted with, say Q_ (vide: rev. 17415 and panel.cpp)
2.) Using the Q_ macro
I have a feeling there is some slight misconception of how this macro is supposed to work. The idea is that the original string is turned into "prefix|string" to make it unique and a call to _() is replaced with a call to Q_(). The Q_() macro itself will call _() (ie. gettext()). The Q_macro will also make sure, that where no translation is available the prefix will be strip from the untranslated text. Please note the attached patch for illustration where this would work OK but an extra call to _() can be avoided.
Please correct me if I'm wrong.
Hope this helps.
Regards, -- Marcin Floryan http://marcin.floryan.pl/ [GPG Key ID: 0D5581C5]
On Wed, Feb 20, 2008 at 03:24:08PM +0100, Marcin Floryan wrote:
2.) Using the Q_ macro
I have a feeling there is some slight misconception of how this macro is supposed to work. The idea is that the original string is turned into "prefix|string" to make it unique and a call to _() is replaced with a call to Q_(). The Q_() macro itself will call _() (ie. gettext()). The Q_macro will also make sure, that where no translation is available the prefix will be strip from the untranslated text. Please note the attached patch for illustration where this would work OK but an extra call to _() can be avoided.
Please correct me if I'm wrong.
It seems I am wrong after all. With the patch attached the translation works OK for localised strings but does not seem to work with default locale. Could someone more experienced clarify?
Regards,
-- Marcin Floryan http://marcin.floryan.pl/ [GPG Key ID: 0D5581C5]
participants (1)
-
Marcin Floryan