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

2016-10-20 Thread Damjan Jovanovic
 stoc/source/javavm/javavm.cxx |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit d61ab2b5a0e35d55cb001e139be791420245bf35
Author: Damjan Jovanovic 
Date:   Thu Oct 20 18:19:18 2016 +

#i86470# Wrong Java locale when using the languagepacks "nl" and "fr"

Languages don't always have a country; if there is no "-" separating
language and country in the ooLocale registry value, use the entire
value as the language.

Patch by: me

diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index bfb62b6..efebe5c 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -424,14 +424,17 @@ void getDefaultLocaleFromConfig(
 css::uno::Reference ooLocale = 
xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale")));
 css::uno::Reference ooSetupSystemLocale = 
xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooSetupSystemLocale")));
 if(ooLocale.is() && ooLocale->getStringValue().getLength()) {
+rtl::OUString language;
 sal_Int32 index = ooLocale->getStringValue().indexOf((sal_Unicode) 
'-');
 if(index >= 0) {
-rtl::OUString language = ooLocale->getStringValue().copy(0, index);
-if(language.getLength()) {
-rtl::OUString 
prop(RTL_CONSTASCII_USTRINGPARAM("user.language="));
-prop += language;
-pjvm->pushProp(prop);
-}
+language = ooLocale->getStringValue().copy(0, index);
+} else {
+language = ooLocale->getStringValue();
+}
+if(language.getLength()) {
+rtl::OUString prop(RTL_CONSTASCII_USTRINGPARAM("user.language="));
+prop += language;
+pjvm->pushProp(prop);
 }
 }
 if(ooSetupSystemLocale.is() && 
ooSetupSystemLocale->getStringValue().getLength()) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-10-20 Thread Damjan Jovanovic
 stoc/source/javavm/javavm.cxx |   24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

New commits:
commit 41b5e943aebdd661198311103775e9edc300572e
Author: Damjan Jovanovic 
Date:   Thu Oct 20 16:34:44 2016 +

#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 xRegistryRootKey = 
xConfRegistry_simple->getRootKey();
 
 // read locale
-css::uno::Reference 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 ooLocale = 
xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("L10N/ooLocale")));
+css::uno::Reference 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);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits