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 408786 - Not enough ngettext translations
Not enough ngettext translations
Status: RESOLVED FIXED
Product: seahorse
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: 1.0.0
Assigned To: Seahorse Maintainer
Seahorse Maintainer
Depends on:
Blocks:
 
 
Reported: 2007-02-17 01:42 UTC by Nickolay V. Shmyrev
Modified: 2007-02-21 03:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (4.79 KB, patch)
2007-02-17 11:30 UTC, Nickolay V. Shmyrev
committed Details | Review

Description Nickolay V. Shmyrev 2007-02-17 01:42:24 UTC
#: ../plugins/nautilus/seahorse-tool.c:372 ../src/seahorse-key-manager.c:405    
#, c-format                                                                     
msgid "Imported %d keys"                                                        
msgstr "Импортировано %d ключей"

#. should never be called for just one file                                     
#: ../plugins/nautilus/seahorse-tool-files.c:174                                
#, c-format                                                                     
msgid "You have selected %d files"                                              
msgstr "Выбрано %d файлов"

#: ../src/seahorse-delete.c:79                                                  
#, c-format                                                                     
msgid "Are you sure you want to permanently delete %d keys?"                    
msgstr "Уверены, что хотите удалить %d ключей?"

#: ../src/seahorse-key-manager.c:573 ../src/seahorse-keyserver-results.c:233    
#, c-format                                                                     
msgid "Copied %d key"                                                           
msgstr "Скопирован %d ключ"

#: ../src/seahorse-key-manager.c:574 ../src/seahorse-keyserver-results.c:234    
#, c-format                                                                     
msgid "Copied %d keys"                                                          
msgstr "Скопировано %d ключей" 

#: ../src/seahorse-key-manager.c:945 ../src/seahorse-keyserver-results.c:298    
#, c-format                                                                     
msgid "Selected %d key"                                                         
msgstr "Выбран %d ключ"                                                         
                                                                                
#: ../src/seahorse-key-manager.c:946 ../src/seahorse-keyserver-results.c:299    
#, c-format                                                                     
msgid "Selected %d keys"                                                        
msgstr "Выделено %d ключей"

This will break string freeze, but I think it's rather critical thing and we should probably break freeze now then later.
Comment 1 Adam Schreiber 2007-02-17 02:08:01 UTC
Are you saying the translation needs to be updated?  I don't think doing that violates the string freeze.  If it's code you want updated, could you please attach a patch?
Comment 2 Nickolay V. Shmyrev 2007-02-17 11:30:42 UTC
Created attachment 82726 [details] [review]
Proposed patch
Comment 3 Adam Schreiber 2007-02-17 12:30:47 UTC
With the exception of src/seahorse-delete.c, it looks like you're just moving the placement of ngettext around.  Is there a good reason to prefer your placement of ngettext over the current one?

At the moment, the only part of the patch I would accept is the portion for src/seahorse-delete.c.
Comment 4 Nickolay V. Shmyrev 2007-02-17 12:41:39 UTC
Hey, we are not moving ngettext around. Without that patch gettext will not know that strings are part of ngettext and will translate them as usual strings.

I pasted strings from po file here, they should be included differently. In trunk we have:

#: ../src/seahorse-key-manager.c:574 ../src/seahorse-keyserver-results.c:234    
#, c-format                                                                     
msgid "Copied %d keys"                                                          
msgstr "" 

#: ../src/seahorse-key-manager.c:945 ../src/seahorse-keyserver-results.c:298    
#, c-format                                                                     
msgid "Copied %d keys" 
msgstr ""

#: ../shell/ev-view.c:4135                                                      
#, c-format                                                                     
msgid "Copied %d key"
msgid_plural "Copied %d keys"
msgstr[0] ""                                                       
msgstr[1] ""
msgstr[2] ""
Comment 5 Adam Schreiber 2007-02-17 12:47:20 UTC
OK. I didn't understand what you were getting at I'll email gnome-i18n for permission to make the break.
Comment 6 Nickolay V. Shmyrev 2007-02-17 12:56:24 UTC
Thanks a lot Adam.
Comment 7 Gabor Kelemen 2007-02-17 14:37:50 UTC
(In reply to comment #2)
> Created an attachment (id=82726) [edit]
> Proposed patch
> 

I don't understand, what are you doing in seahorse-tool.c. 
Adding only the 
+	t = g_strdup_printf (ngettext ("Imported %d key", "Imported %d keys", mode->imports), mode->imports);
line would be enough, wouldn't? 
Compare to the changes of seahorse-key-manager.c; this is the same situation.
Comment 8 Nickolay V. Shmyrev 2007-02-17 14:48:21 UTC
In reply to comment #7

It's just the same as it were before, sometimes it would be nice to avoid numbers in messages, that's why case mode->imports == 1 is separated.
Comment 9 tokul 2007-02-17 16:04:45 UTC
(In reply to comment #4)
> Hey, we are not moving ngettext around. Without that patch gettext will not
> know that strings are part of ngettext and will translate them as usual
> strings.

If you change translation from gettext to ngettext and translated messages are merged with string template, modified string will be marked as fuzzy. If translation has 100% translated strings, it will have 100% - 1 translated string and one fuzzy string. If you don't have other code with same string in ngettext format, it is a string break. Some translators don't like when their translation status goes down from 100% in stable branch. Get gnome-i18n approval or make sure that translation quality doesn't go worse after your mods.
Comment 10 Adam Schreiber 2007-02-17 18:17:16 UTC
(In reply to comment #9)
> Some translators don't like when their
> translation status goes down from 100% in stable branch. Get gnome-i18n
> approval or make sure that translation quality doesn't go worse after your
> mods.
> 

Good thing we're discussing a development branch.  Approval from gnome-i18n has been requested.
Comment 11 Gabor Kelemen 2007-02-17 18:33:48 UTC
(In reply to comment #8)

I understand, but I don't think this implementation is correct. 

Your current logic looks like this: 

if ($value==1) 
  then (use one_item)
else if ($value=="plural_expression")
        then (use plural)
     else (use singular)

This is ugly. 
I don't know which howto or guideline advises to not to use this - if there are any. But this is simply ugly, and Gnome doesn't uses this form anyway. This assumes there are three different forms of the sentence, one for the value==1 case and two other for the singular/plural case - for all the languages available. Furthermore, it assumes the value==1 and singular cases are different - this is not true even for English, and the original sentences were not these. 
So, I propose to use 
ngettext ("Imported key", "Imported %d keys", mode->imports)
Comment 12 tokul 2007-02-17 19:05:10 UTC
(In reply to comment #11)
> This is ugly. 
> I don't know which howto or guideline advises to not to use this - if there are
> any. But this is simply ugly, and Gnome doesn't uses this form anyway. This
> assumes there are three different forms of the sentence, one for the value==1
> case and two other for the singular/plural case - for all the languages
> available. Furthermore, it assumes the value==1 and singular cases are
> different - this is not true even for English, and the original sentences were
> not these. 
> So, I propose to use 
> ngettext ("Imported key", "Imported %d keys", mode->imports)

You assume that first form applies only to 1. 

"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);"

1 raktas (first form)
2 raktai (second form)
10 raktu (third form)
21 raktas (first form)

Nikolay wants to display string without number, when %d equals to one. First ngettext form can be applied to other values of %d.

In your case if some translation follows English rules and translators do
---
msgid "Imported key"
msgid_plural "Imported %d keys"
msgstr[0] "Imported key"
msgstr[1] "Imported %d keys"
---

they will get errors on gettext check
---
test.po:24: number of format specifications in 'msgid' and 'msgstr[0]' does not match msgfmt: found 1 fatal error
---

Translations pass msgfmt checks and translators will be forced to use
---
msgid "Imported key"
msgid_plural "Imported %d keys"
msgstr[0] "Imported %d key"
msgstr[1] "Imported %d keys"
---

String without %d will be used only in US English
Comment 13 André Klapper 2007-02-18 23:14:53 UTC
same with czech language, the plural form changes from 4 to 5. everybody please use proper ngettext code instead of ugly workarounds. :-)
Comment 14 Stef Walter 2007-02-21 00:15:14 UTC
Is this just waiting on gnome-i18n, or is the patch incomplete?
Comment 15 Nickolay V. Shmyrev 2007-02-21 00:27:13 UTC
We just need approval, sadly i18 team seems to be absent
Comment 16 Adam Schreiber 2007-02-21 02:56:44 UTC
I received this:

Hi Adam,

On Saturday at 10:51, Adam Schreiber wrote:

> It has recently come to our attention that we were improperly using
> ngettext [1] and this was causing the number related translations to
> appear as normal strings and not together as a set.
>
> We are requesting permission to break string freeze to fix this.  It
> shouldn't require any additional translation just moving the current
> translated strings around a little.
>
> [1] http://bugzilla.gnome.org/show_bug.cgi?id=408786

Since there seems to be a lot of interest by translators for this,
here's my (late) approval.

I also CCed release-team, since they need to know about this as well.

Cheers,
Danilo
Comment 17 Adam Schreiber 2007-02-21 03:02:48 UTC
Committed. Thanks.

2007-02-20  Adam Schreiber  <sadam@clemson.edu>

    * src/seahorse-delete.c:
    * src/seahorse-keyserver-results.c:
    * src/seahorse-key-manager.c:
    * plugins/nautilus/seahorse-tool.c: Fix ngettext usage.  Patch from 
    Nickolay V. Shmyrev.  Fixes bug #408786
Comment 18 Nickolay V. Shmyrev 2007-02-21 03:05:00 UTC
Thanks a lot Adam