[Libreoffice-commits] core.git: Branch 'aoo/trunk' - stoc/source

Damjan Jovanovic damjan at apache.org
Thu Oct 20 18:16:53 UTC 2016


 stoc/source/javavm/javavm.cxx |   24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

New commits:
commit 41b5e943aebdd661198311103775e9edc300572e
Author: Damjan Jovanovic <damjan at apache.org>
Date:   Thu Oct 20 16:34:44 2016 +0000

    #i80654# Java locale is set based on UI language rather than locale setting
    
    Construct Java's language from the "User interface" language, and Java's
    country from the "Locale setting" country in the "Language settings" ->
    "Languages" options. This way, the user interface language will be the same
    in AOO and Java, while the locale settings in Java won't depend on that
    language but rather on the country.
    
    This should fix the bug in Java, BeanShell, and Javascript.
    
    Patch by: me

diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index b205c72..bfb62b6 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -421,28 +421,26 @@ void getDefaultLocaleFromConfig(
     css::uno::Reference<css::registry::XRegistryKey> xRegistryRootKey = xConfRegistry_simple->getRootKey();
 
     // read locale
-    css::uno::Reference<css::registry::XRegistryKey> locale = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale")));
-    if(locale.is() && locale->getStringValue().getLength()) {
-        rtl::OUString language;
-        rtl::OUString country;
-
-        sal_Int32 index = locale->getStringValue().indexOf((sal_Unicode) '-');
-
+    css::uno::Reference<css::registry::XRegistryKey> ooLocale = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale")));
+    css::uno::Reference<css::registry::XRegistryKey> ooSetupSystemLocale = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooSetupSystemLocale")));
+    if(ooLocale.is() && ooLocale->getStringValue().getLength()) {
+        sal_Int32 index = ooLocale->getStringValue().indexOf((sal_Unicode) '-');
         if(index >= 0) {
-            language = locale->getStringValue().copy(0, index);
-            country = locale->getStringValue().copy(index + 1);
-
+            rtl::OUString language = ooLocale->getStringValue().copy(0, index);
             if(language.getLength()) {
                 rtl::OUString prop(RTL_CONSTASCII_USTRINGPARAM("user.language="));
                 prop += language;
-
                 pjvm->pushProp(prop);
             }
-
+        }
+    }
+    if(ooSetupSystemLocale.is() && ooSetupSystemLocale->getStringValue().getLength()) {
+        sal_Int32 index = ooSetupSystemLocale->getStringValue().indexOf((sal_Unicode) '-');
+        if(index >= 0) {
+            rtl::OUString country = ooSetupSystemLocale->getStringValue().copy(index + 1);
             if(country.getLength()) {
                 rtl::OUString prop(RTL_CONSTASCII_USTRINGPARAM("user.country="));
                 prop += country;
-
                 pjvm->pushProp(prop);
             }
         }


More information about the Libreoffice-commits mailing list