Author: damjan
Date: Thu Oct 20 18:19:18 2016
New Revision: 1765857

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


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=1765857&r1=1765856&r2=1765857&view=diff
==============================================================================
--- openoffice/trunk/main/stoc/source/javavm/javavm.cxx (original)
+++ openoffice/trunk/main/stoc/source/javavm/javavm.cxx Thu Oct 20 18:19:18 2016
@@ -424,14 +424,17 @@ void getDefaultLocaleFromConfig(
        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()) {
+               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()) {


Reply via email to