Bug 96127

Summary: plural forms for ga locale are incorrect
Product: [Translations] i18n Reporter: Kevin Scannell <kscanne>
Component: gaAssignee: Barry O'Donovan <barry>
Status: RESOLVED FIXED    
Severity: normal CC: barry, nicolasg
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: klocale-ga-patch.diff

Description Kevin Scannell 2005-01-01 21:15:23 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    Gentoo Packages
OS:                Linux

The hard-coded plural forms code in kdecore/klocale.cpp
for Irish Gaelic (Gaeilge) are incorrect.  Note that
our language already has its own case in the switch
statement on lines 832-839.  

The correct form we've been using with GNU gettext is this:

Plural-Forms: nplurals=5; plural=n==1 ? 0 : (n==2) ? 1 : (n>2 && n<7) ? 2 : (n>6 && n<11) ? 3 : 4;

The most general case is illustrated when translating "%d things"
or "%d of them":

one: "ceann amháin"
two: "dhá cheann"
3-6: "%d cinn"
7-10: "%d gcinn"
11+: "%d ceann"

(sometimes numbers > 10 are handled differently in print but this 
way of doing things seems perfectly grammatical and simple)
Comment 1 Barry O'Donovan 2005-02-19 12:54:17 UTC
Hi folks,

Please find attached a suggested patch to close bug 96127 
(http://bugs.kde.org/show_bug.cgi?id=96127). 

I am not up to speed with the KDE i18n framework so I'm winging it a 
bit. If this is not the correct way to solve this problem then any 
suggestions will be gratefully appreciated.

If the patch is okay, is there any other files that need modification 
before closing the bug report?

Kind regards,
Barry



Created an attachment (id=9720)
klocale-ga-patch.diff
Comment 2 Stephan Kulow 2005-02-19 18:45:22 UTC
ga is the language that still has no valid translation of the Pluralform string in kdelibs.po, right?
Comment 3 Kevin Scannell 2005-02-19 20:08:20 UTC
That's right.  Should I use "Gaeilge" or "OneTwoRest"?
Or maybe the name "OneTwoRest" should be changed along with the rules
for clarity's sake?
Comment 4 Barry O'Donovan 2005-02-19 20:12:53 UTC
On Saturday 19 February 2005 19:08, Kevin Scannell wrote:
> ------- Additional Comments From scannell slu edu  2005-02-19 20:08
> ------- That's right.  Should I use "Gaeilge" or "OneTwoRest"?
> Or maybe the name "OneTwoRest" should be changed along with the rules
> for clarity's sake?

OneTwoRest as implemented only allows for three forms. It's up to 
Stephen but the patch I sent along creates "Gaeilge" allowing for the 
five forms.

Barry
Comment 5 Stephan Kulow 2005-02-20 12:50:41 UTC
CVS commit by coolo: 

another case for plural forms
BUG: 96127


  M +18 -3     klocale.cpp   1.364


--- kdelibs/kdecore/klocale.cpp  #1.363:1.364
@@ -225,5 +225,5 @@ int KLocale::pluralType( const KCatalogu
     else if ( pf == "French" )
       return 2;
-    else if ( pf == "OneTwoRest" || pf == "Gaeilge" ) // Gaelige is the old name
+    else if ( pf == "OneTwoRest" )
       return 3;
     else if ( pf == "Russian" )
@@ -247,4 +247,6 @@ int KLocale::pluralType( const KCatalogu
     else if ( pf == "Macedonian" )
       return 13;
+    else if ( pf == "Gaeilge" )
+        return 14;
     else {
       kdWarning(173) << "Definition of PluralForm is none of "
@@ -262,4 +264,5 @@ int KLocale::pluralType( const KCatalogu
                        << "Balcan/"
                        << "Macedonian/"
+               << "Gaeilge/"
                        << "Maltese: " << pf << endl;
       exit(1);
@@ -830,5 +833,5 @@ QString KLocale::translate( const char *
     else
       return put_n_in( forms[1], n);
-  case 3: // Gaeilge
+  case 3: // OneTwoRest
     EXPECT_LENGTH( 3 );
     if ( n == 1 )
@@ -924,4 +927,16 @@ QString KLocale::translate( const char *
      else
         return put_n_in(forms[2], n);
+  case 14: // Gaeilge
+      EXPECT_LENGTH(5);
+      if (n == 1)                       // "ceann amhain"
+          return put_n_in(forms[0], n);
+      else if (n == 2)                  // "dha cheann"
+          return put_n_in(forms[1], n);
+      else if (n < 7)                   // "%n cinn"
+          return put_n_in(forms[2], n);
+      else if (n < 11)                  // "%n gcinn"
+          return put_n_in(forms[3], n);
+      else                              // "%n ceann"
+          return put_n_in(forms[4], n);
   }
   kdFatal() << "The function should have been returned in another way\n";


Comment 6 Stephan Kulow 2005-02-20 12:51:48 UTC
CVS commit by coolo: 

finally a value for it
CCBUG: 96127


  M +1 -0      check_po_files   1.68
  M +1 -1      ga/messages/kdelibs/kdelibs.po   1.417


--- kde-i18n/check_po_files  #1.67:1.68
@@ -108,4 +108,5 @@
  'fr' => 2,
  'fy' => 2,
+ 'ga' => 5,
  'gl' => 2,
  'he' => 2,

--- kde-i18n/ga/messages/kdelibs/kdelibs.po  #1.416:1.417
@@ -3436,5 +3436,5 @@
 "that out if unsure, the programs will crash!!\n"
 "Definition of PluralForm - to be set by the translator of kdelibs.po"
-msgstr ""
+msgstr "Gaeilge"
 
 #: kdecore/kcalendarsystemgregorian.cpp:91 kdecore/klocale.cpp:543