[Bug 345587] Re: Not showing localized plural strings

Milo Casagrande milo at milo.name
Sat Mar 21 18:46:21 UTC 2009


Il giorno sab, 21/03/2009 alle 17.38 +0000, Christoph Korn ha scritto:
> I tried to fix that by removing the N_ before the strings.
> But that did not work.
> 
> Still only the singular localized string is shown.

Hmmm... probably I didn't explain myself in the best way with my last
message.

>From my POV, the problem is not with the use of the N_() macro itself,
but how it is used in this situation.

I'll start with the case of the not localized title and buttons, because
probably it's easier.

I'll take some snippets from the code:

gtk_label_set_text(GTK_LABEL(dialog->title),title_strings[dialog->action]);

In this case, the title_strings[dialog->action] elements are translated
here:

/*LOGOUT_DIALOG_LOGOUT,*/ N_("Log Out"),
/*LOGOUT_DIALOG_RESTART,*/ N_("Restart"),
/*LOGOUT_DIALOG_SHUTDOWN,*/ N_("Shut Down")

If I'm not totally wrong, when using N_() to postpone actual
translation, I need to use _() (or gettext()) around the "caller". So,
it should be:

gtk_label_set_text(GTK_LABEL(dialog->title),_(title_strings[dialog->action]));

And so on for the other elements (BTW, there is also another problem
here, but I'll talk about it at the end of the mail [1]).

The problem seems more complex with the handling of plural forms, like
here:

gchar * timeouttxt =
g_strdup_printf(ngettext(singular_strings[dialog->action],
plural_strings[dialog->action], dialog->timeout), dialog->timeout);

I don't know if using _() around the "caller" here will work out fine. I
don't know how gettext, when extracting the strings, will map all the
cases that are in the structure that defines the translatable strings.

In my mind, I would rather take case by case with a switch case using
one ngettext call for each plural I need, but it's a big code change to
do.

Sorry if I don't present a patch, but my C coding skills date back 4
years ago and have never had the chance to code in C again (even if this
would be a good chance), I will probably do more harm than good right
now.

Hope that my POV could be of some use anyway.

Cheers.

[1] Here we are using the same string as a title and as a button label:
there could be languages that translate those elements in a different
way. Using a context here would be great.

-- 
Milo Casagrande <milo at milo.name>

-- 
Not showing localized plural strings
https://bugs.launchpad.net/bugs/345587
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list