[haiku-commits] r36295 - haiku/trunk/src/kits/locale

Author: pulkomandy
Date: 2010-04-15 16:57:39 +0200 (Thu, 15 Apr 2010)
New Revision: 36295
Changeset: http://dev.haiku-os.org/changeset/36295/haiku

Modified:
   haiku/trunk/src/kits/locale/Language.cpp
   haiku/trunk/src/kits/locale/LocaleRoster.cpp
Log:
Fix Language::GetName using the system-wide language settings instead of the 
current application one. Make ReadOnlyBootPrompt localize the list instantly 
when you select a language in it.


Modified: haiku/trunk/src/kits/locale/Language.cpp
===================================================================
--- haiku/trunk/src/kits/locale/Language.cpp    2010-04-15 14:20:02 UTC (rev 
36294)
+++ haiku/trunk/src/kits/locale/Language.cpp    2010-04-15 14:57:39 UTC (rev 
36295)
@@ -8,6 +8,9 @@
 
 #include <iostream>
 
+#include <Catalog.h>
+#include <Locale.h>
+#include <LocaleRoster.h>
 #include <Path.h>
 #include <String.h>
 #include <FindDirectory.h>
@@ -133,10 +136,16 @@
 status_t
 BLanguage::GetName(BString* name)
 {
-       // TODO: This will return the language not in the current 
be_app_catalog,
-       // but in the current system wide language! Don't know the exact reason.
+       BMessage preferredLanguage;
+       be_locale_roster->GetPreferredLanguages(&preferredLanguage);
+       BString appLanguage;
+       
+       preferredLanguage.FindString("language", 0, &appLanguage);
+       
+       printf("lang : %s\n",appLanguage.String());
+       
        UnicodeString s;
-       fICULocale->getDisplayName(s);
+       fICULocale->getDisplayName(Locale(appLanguage), s);
        BStringByteSink converter(name);
        s.toUTF8(converter);
        return B_OK;

Modified: haiku/trunk/src/kits/locale/LocaleRoster.cpp
===================================================================
--- haiku/trunk/src/kits/locale/LocaleRoster.cpp        2010-04-15 14:20:02 UTC 
(rev 36294)
+++ haiku/trunk/src/kits/locale/LocaleRoster.cpp        2010-04-15 14:57:39 UTC 
(rev 36295)
@@ -182,10 +182,8 @@
        BAutolock lock(fLock);
        assert(lock.IsLocked());
 
-       // TODO: make a decision about log-facility and -options
        openlog_team("liblocale.so", LOG_PID, LOG_USER);
 #ifndef DEBUG
-       // TODO: find out why the following bugger isn't working!
        setlogmask_team(LOG_UPTO(LOG_WARNING));
 #endif
 
@@ -650,9 +648,9 @@
                        // other languages.
                        // The current implementation uses the filename in 
order to
                        // detect dependencies (parenthood) between languages 
(it
-                       // traverses from "english-british-oxford" to 
"english-british"
+                       // traverses from "english_british_oxford" to 
"english_british"
                        // to "english"):
-                       // TODO :use ICU facilities instead, so we can handle 
more
+                       // TODO: use ICU facilities instead, so we can handle 
more
                        // complex things such as fr_FR@euro, or whatever, 
encodings
                        // and so on.
                        int32 pos;


Other related posts:

  • » [haiku-commits] r36295 - haiku/trunk/src/kits/locale - pulkomandy