summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-06-03 11:49:09 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-06-03 14:32:22 (GMT)
commitf1e471b561012f90938766c00aefff417593e71f (patch)
tree3919326ebb207e6ed6f8d1fd64ad3f7a90a9d6eb
parent11e77b1e47d527a2c4bca6c72d4597bfd8b8a1c3 (diff)
downloadQt-f1e471b561012f90938766c00aefff417593e71f.zip
Qt-f1e471b561012f90938766c00aefff417593e71f.tar.gz
Qt-f1e471b561012f90938766c00aefff417593e71f.tar.bz2
fix catalan plural rules
-rw-r--r--src/corelib/kernel/qtranslator.cpp3
-rw-r--r--src/corelib/kernel/qtranslator_p.h1
-rw-r--r--tools/linguist/shared/numerus.cpp9
3 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 3e4b467..df904a6 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -149,6 +149,9 @@ static int numerusHelper(int n, const uchar *rules, int rulesSize)
leftOperand %= 10;
} else if (opcode & Q_MOD_100) {
leftOperand %= 100;
+ } else if (opcode & Q_LEAD_1000) {
+ while (leftOperand >= 1000)
+ leftOperand /= 1000;
}
int op = opcode & Q_OP_MASK;
diff --git a/src/corelib/kernel/qtranslator_p.h b/src/corelib/kernel/qtranslator_p.h
index 77ec8f5..a7d58c5 100644
--- a/src/corelib/kernel/qtranslator_p.h
+++ b/src/corelib/kernel/qtranslator_p.h
@@ -62,6 +62,7 @@ enum {
Q_NOT = 0x08,
Q_MOD_10 = 0x10,
Q_MOD_100 = 0x20,
+ Q_LEAD_1000 = 0x40,
Q_AND = 0xFD,
Q_OR = 0xFE,
diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp
index 2fe1c78..50e85cb 100644
--- a/tools/linguist/shared/numerus.cpp
+++ b/tools/linguist/shared/numerus.cpp
@@ -105,6 +105,9 @@ static const uchar arabicRules[] =
static const uchar tagalogRules[] =
{ Q_LEQ, 1, Q_NEWRULE,
Q_MOD_10 | Q_EQ, 4, Q_OR, Q_MOD_10 | Q_EQ, 6, Q_OR, Q_MOD_10 | Q_EQ, 9 };
+static const uchar catalanRules[] =
+ { Q_EQ, 1, Q_NEWRULE,
+ Q_LEAD_1000 | Q_EQ, 11 };
static const char * const japaneseStyleForms[] = { "Universal Form", 0 };
static const char * const englishStyleForms[] = { "Singular", "Plural", 0 };
@@ -127,6 +130,7 @@ static const char * const arabicForms[] =
{ "Nullar", "Singular", "Dual", "Minority Plural", "Plural", "Plural Form for 100, 200, ...", 0 };
static const char * const tagalogForms[] =
{ "Singular", "Plural (consonant-ended)", "Plural (vowel-ended)", 0 };
+static const char * const catalanForms[] = { "Singular", "Undecal (11)", "Plural", 0 };
#define EOL QLocale::C
@@ -173,7 +177,6 @@ static const QLocale::Language englishStyleLanguages[] = {
// Missing: Bokmal,
QLocale::Bulgarian,
QLocale::Cambodian,
- QLocale::Catalan,
QLocale::Cornish,
QLocale::Corsican,
QLocale::Danish,
@@ -300,6 +303,7 @@ static const QLocale::Language malteseLanguage[] = { QLocale::Maltese, EOL };
static const QLocale::Language welshLanguage[] = { QLocale::Welsh, EOL };
static const QLocale::Language arabicLanguage[] = { QLocale::Arabic, EOL };
static const QLocale::Language tagalogLanguage[] = { QLocale::Tagalog, EOL };
+static const QLocale::Language catalanLanguage[] = { QLocale::Catalan, EOL };
static const QLocale::Country frenchStyleCountries[] = {
// keep synchronized with frenchStyleLanguages
@@ -334,7 +338,8 @@ static const NumerusTableEntry numerusTable[] = {
{ malteseRules, sizeof(malteseRules), malteseForms, malteseLanguage, 0 },
{ welshRules, sizeof(welshRules), welshForms, welshLanguage, 0 },
{ arabicRules, sizeof(arabicRules), arabicForms, arabicLanguage, 0 },
- { tagalogRules, sizeof(tagalogRules), tagalogForms, tagalogLanguage, 0 }
+ { tagalogRules, sizeof(tagalogRules), tagalogForms, tagalogLanguage, 0 },
+ { catalanRules, sizeof(catalanRules), catalanForms, catalanLanguage, 0 }
};
static const int NumerusTableSize = sizeof(numerusTable) / sizeof(numerusTable[0]);