Bug 303710

Summary: digiKam shows 0 plugin in english, but in translations shows 1 plugin
Product: [Translations] i18n Reporter: André Marcelo Alvarenga <alvarenga>
Component: pt-BRAssignee: kde-i18n-pt_br <kde-i18n-pt_br>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, aspotashev, elchevive
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screenshot
Path to digiKam

Description André Marcelo Alvarenga 2012-07-17 23:24:05 UTC
See screenshot.
When I open digiKam in english language - 0 plugin
When I open digiKam in pt_BR language - 1 plugin, but no plugin installed

Reproducible: Always

Steps to Reproduce:
1. Settings -> Configure digiKam -> Kipi Plugins



pt_BR digikam.po:

#: utilities/setup/setupplugins.cpp:135
#, kde-format
msgid "1 Kipi plugin found"
msgid_plural "%1 Kipi plugins found"
msgstr[0] "1 plugin do Kipi encontrado"
msgstr[1] "%1 plugins do Kipi encontrados"
Comment 1 André Marcelo Alvarenga 2012-07-17 23:24:46 UTC
Created attachment 72596 [details]
Screenshot
Comment 2 André Marcelo Alvarenga 2012-07-18 22:33:33 UTC
Fixed in pt_BR with msgstr[0] to "%1 plugin do Kipi encontrado", but I think the msgid should be:

msgid "%1 Kipi plugin found" NOT msgid "1 Kipi plugin found"

French (fr) translation has the same problem.
Comment 3 André Marcelo Alvarenga 2012-07-18 23:16:16 UTC
Created attachment 72616 [details]
Path to digiKam

I think this patch can fix the bug.
Comment 4 Alexander Potashev 2012-07-19 23:38:13 UTC
(In reply to comment #3)
> Created attachment 72616 [details]
> Path to digiKam
> 
> I think this patch can fix the bug.

The bug was already fixed by changing pt_BR translation, right? A similar change can be done in the French translation. The original English string is correct - no matter whether it is "1 Kipi plugin found" or "%1 Kipi plugin found".
Comment 5 André Marcelo Alvarenga 2012-08-21 12:39:49 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Created attachment 72616 [details]
> > Path to digiKam
> > 
> > I think this patch can fix the bug.
> 
> The bug was already fixed by changing pt_BR translation, right? A similar
> change can be done in the French translation. The original English string is
> correct - no matter whether it is "1 Kipi plugin found" or "%1 Kipi plugin
> found".

I already made the change in pt_BR translation, but I still think the fix is necessary for this reason:


http://techbase.kde.org/Localization/Concepts/PO_Odyssey#Plural_Forms

[...]

However, while this works for some languages other than English (e.g. Spanish, German, French...), it does not work for all languages. The reason is that, while English needs one text for unity, and another text for any other number, many languages have it more complicated. For example, in some languages the singular form is used for all numbers ending with the digit 1, so application would be in error to fetch the singular form only for number exactly 1. Furthermore, in some languages more than two texts are needed, for example three: one for all numbers ending in 1, second for all numbers ending in 2, 3, 4, and third for all other numbers.

To handle this diversity, the PO format implements plural messages. The example above in reality looks like this:

#: mainwindow.cpp:127
#, kde-format
msgid "Time: %1 second"
msgid_plural "Time: %1 seconds"
msgstr[0] ""
msgstr[1] ""

[...]


I hope this will also benefit Brazilian Portuguese and other languages.
Comment 6 Albert Astals Cid 2012-08-21 18:58:23 UTC
I don't understand the problem, ommiting the number is fine

http://techbase.kde.org/Localization/Concepts/PO_Odyssey#Omitting_The_Number

Actually our examples says 
http://api.kde.org/4.8-api/kdelibs-apidocs/kdecore/html/classKLocalizedString.html
QString msg = i18np("One image in album %2", "%1 images in album %2",                      numImages, albumName);

So can you explain why you think the code is wrong
Comment 7 Luiz Fernando Ranghetti 2012-08-21 20:37:59 UTC
Hi Albert,

The problem is the original string: (using es as example as it has this 'bug' also, as probably every translationg in KDE)

msgid "1 Kipi plugin found"
msgid_plural "%1 Kipi plugins found"
msgstr[0] "1 complemento Kipi encontrado"
msgstr[1] "%1 complementos Kipi encontrados"

The singular form is also used if NO plug-ins are found. Which leads every translation to display an incorrect information (1 instead of 0)

Regards,

Luiz
Comment 8 Albert Astals Cid 2012-08-21 21:07:02 UTC
Why would the singular be used if no plugins are found?

Oh, i know why, because you set your headers wrong in pt_BR

"Plural-Forms: nplurals=2; plural=(n > 1);\n"
seems like should be
"Plural-Forms: nplurals=2; plural=n != 1;\n"

If Brazilian Portuguese is like Catalan or Spanish where the plural form is use for 0 too
Comment 9 Albert Astals Cid 2012-08-21 21:42:43 UTC
Hmmm, wait, i'm reading that Brazilian Portuguese actually uses the singular for 0, then the plural-forms definition is fine.

But you need to be aware that for all the "plural" translations, in the first case it can be 0 or 1 and have to translate accordingly.
Comment 10 Alexander Potashev 2012-08-21 21:47:56 UTC
(In reply to comment #9)
> Hmmm, wait, i'm reading that Brazilian Portuguese actually uses the singular
> for 0, then the plural-forms definition is fine.
> 
> But you need to be aware that for all the "plural" translations, in the
> first case it can be 0 or 1 and have to translate accordingly.

Alternatively, you can change the plural selection formula in all KDE translations in pt_BR.
Comment 11 Luiz Fernando Ranghetti 2012-08-21 22:14:27 UTC
I know that scripty uses one file as basis for automatically correct this header, did you know what? kdelibs4.po maybe?

Thanks for your help
Comment 12 Albert Astals Cid 2012-08-21 22:23:54 UTC
Yes, but what you want to do? use three plurals for all the messages? that's going to be a big pain right?
Comment 13 Luiz Fernando Ranghetti 2012-08-21 22:39:50 UTC
Yes, will be a pain. Probably we will have to discuss this on kde-i18n-pt_br list. To warn the others translators about this (I didn't know this) and see what we will do.

Again, thanks for explaining it on ml!
Comment 14 Alexander Potashev 2012-08-22 22:58:34 UTC
Luiz,

If you are going to switch to usage of three plural forms, please remember to properly convert all existing translations, otherwise translations of all messages with plural forms may be removed by "scripty" or become incorrect. See http://old.nabble.com/Changing-the-number-of-plural-forms-td28859344.html