Author: damjan
Date: Thu Oct 20 16:34:44 2016
New Revision: 1765849

URL: http://svn.apache.org/viewvc?rev=1765849&view=rev
Log:
#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


Modified:
    openoffice/trunk/main/stoc/source/javavm/javavm.cxx

Modified: openoffice/trunk/main/stoc/source/javavm/javavm.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/stoc/source/javavm/javavm.cxx?rev=1765849&r1=1765848&r2=1765849&view=diff
==============================================================================
--- openoffice/trunk/main/stoc/source/javavm/javavm.cxx (original)
+++ openoffice/trunk/main/stoc/source/javavm/javavm.cxx Thu Oct 20 16:34:44 2016
@@ -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);
                        }
                }


Reply via email to