[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    [PATCH] Allow languages to override nounDeclension of locale
From:       Adriaan de Groot <adridg () cs ! kun ! nl>
Date:       2004-04-29 20:10:21
Message-ID: 200404292210.27829.adridg () cs ! kun ! nl
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The attached patch moves some stuff around in KLocale, reading from _three_ 
config files instead of just two, now. This allows you to add a

	NounDeclension=true

line to the language's entry.desktop, which will override the locale's one. I 
think Edi put it well why this is a good thing. It certainly allows me to run 
both hsb and cs with correct declension of months in KOrganizer in my C and 
nl locales, which it otherwise wouldn't.


- -- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot@kde.org>
                     Would you like a freem?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAkWEzdqzuAf6io/4RAhbgAJ0V1sunuF+98gMictCaiImSXWSA2gCfUpzr
afzVBJEvBa4do4p7W2rkB5Q=
=F6uI
-----END PGP SIGNATURE-----

["diff" (text/x-diff)]

Index: klocale.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/klocale.cpp,v
retrieving revision 1.344.2.1
diff -u -3 -p -r1.344.2.1 klocale.cpp
--- klocale.cpp	19 Jan 2004 21:16:06 -0000	1.344.2.1
+++ klocale.cpp	29 Apr 2004 20:02:06 -0000
@@ -317,15 +317,11 @@ void KLocale::initFormat()
   readConfigNumEntry("NegativeMonetarySignPosition", (int)ParensAround,
 		     m_negativeMonetarySignPosition, SignPosition);
 
-  //Grammatical
-  readConfigBoolEntry("NounDeclension", false, d->nounDeclension);
 
   // Date and time
   readConfigEntry("TimeFormat", "%H:%M:%S", m_timeFormat);
   readConfigEntry("DateFormat", "%A %d %B %Y", m_dateFormat);
   readConfigEntry("DateFormatShort", "%Y-%m-%d", m_dateFormatShort);
-  readConfigBoolEntry("DateMonthNamePossessive", false,
-		      d->dateMonthNamePossessive);
   readConfigNumEntry("WeekStartDay", 1, d->weekStartDay, int);
 
   // other
@@ -336,6 +332,21 @@ void KLocale::initFormat()
   delete d->calendar;
   d->calendar = 0; // ### HPB Is this the correct place?
 
+  //Grammatical
+  //Precedence here is l10n / i18n / config file
+  KSimpleConfig language(locate("locale",
+			        QString::fromLatin1("%1/entry.desktop")
+                                .arg(m_language)), true);
+  language.setGroup("KCM Locale");
+#define read3ConfigBoolEntry(key, default, save) \
+  save = entry.readBoolEntry(key, default); \
+  save = language.readBoolEntry(key, save); \
+  save = config->readBoolEntry(key, save);
+
+  read3ConfigBoolEntry("NounDeclension", false, d->nounDeclension);
+  read3ConfigBoolEntry("DateMonthNamePossessive", false,
+		       d->dateMonthNamePossessive);
+
   // end of hack
   KGlobal::_locale = lsave;
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic