After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 344896 - one gettext form used for plural string with numbers
one gettext form used for plural string with numbers
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: general
CVS head
Other All
: Normal trivial
: 0.96
Assigned To: Dia maintainers
Dia maintainers
Depends on:
Blocks:
 
 
Reported: 2006-06-14 18:22 UTC by tokul
Modified: 2006-06-25 17:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description tokul 2006-06-14 18:22:35 UTC
Please describe the problem:
app/display.c uses simple gettext call to translate text with numbers.

msg = g_strdup_printf (_("Selection of %d objects"), n);

Such gettext call works only in languages that have one form for all n>1 strings. Strings with numbers should use ngettext calls.


Steps to reproduce:
You can't translate "Selection of %d objects" string correctly in some languages.

Actual results:


Expected results:
I suspect that correct call is

msg = g_strdup_printf (ngettext(N_("Selection of %d object"),N_("Selection of %d objects"),n), n);


Does this happen every time?


Other information:
Comment 1 Hans Breuer 2006-06-15 13:28:50 UTC
Iy you look some line above the line in quuestion you'll see
'if (n > 1)' so it is ensured that the plural from is always
required. For a single object selection it's name is displayed.
Comment 2 tokul 2006-06-15 13:38:32 UTC
Translation of "%d objects" to Lithuanian

%d is from 2 to 9
2-9 objektai

%d is from 10 to 20
10-20 objektu

%d is 21
21 objektas

%d is from 22 to 29
22-29 objektai

there are 3 different word forms for "object" in Lithuanian and they depend on %d.  Only some languages have one noun form for %d = 1 and other form for %d > 1.

See http://www.gnu.org/software/gettext/manual/html_chapter/gettext_10.html#SEC150
Comment 3 Hans Breuer 2006-06-15 13:58:50 UTC
Thanks for the explanation, now fix as you suggested.
And feel free to reopen when I'm wrong ;-)

2006-06-15  Hans Breuer  <hans@breuer.org>

	* app/display.c : use ngettext() for possible plural variations.
	(Bug #344896, tokul@users.sourceforge.net)
	
Comment 4 Hans Breuer 2006-06-15 13:59:53 UTC
Noise because there is no direct way from "Not a bug"->"Fixed"
Comment 5 tokul 2006-06-15 16:07:14 UTC
Sorry. used broken code sample from gnumeric. Standard gettext calls are not needed inside ngettext call.

msg = g_strdup_printf (ngettext("Selection of %d object","Selection of %d objects",n), n);

I am not sure if fix is correct and does not require more changes in dia code. I am not C programmer and don't have i18n coding experience in gnome.
Comment 6 tokul 2006-06-25 17:24:18 UTC
Reopening the bug. I've used broken code from Gnumeric.

http://bugzilla.gnome.org/show_bug.cgi?id=345027

Don't use gettext calls inside ngettext call.
Comment 7 Hans Breuer 2006-06-25 17:34:02 UTC
2006-06-25  Hans Breuer  <hans@breuer.org>

	* app/display.c : avoid to call gettext on parameters for ngettext()
	Should finally really fix bug #344896