diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-10-25 19:58:04 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-10-25 21:55:16 +0000 |
commit | f08ef855b1402cbebd3675621c65f0c7660401fd (patch) | |
tree | 2fcd0cec1ac8a224f1379c6ac26327a020491f77 /stoc/source/javavm | |
parent | 48304cb5b4d8df71463837e2e48aa7c4d9594df9 (diff) |
Revert "Revert "Resolves: #i86470# Wrong Java locale when using "nl" and "fr"""
This reverts commit 4c13c4da1616317555ed3470603ff786db772d64, after
475e4b477c6d7ae114c3ae51ba4872882af67a68 "Move i18nlangtag lib to URELIB".
Change-Id: I61eb0c786b1fac8eb51db7b54156c906398dfb48
Reviewed-on: https://gerrit.libreoffice.org/30279
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc/source/javavm')
-rw-r--r-- | stoc/source/javavm/javavm.cxx | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 87196d5e9d63..b27df6f2e19b 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -71,6 +71,7 @@ #include <uno/current_context.hxx> #include <uno/environment.h> #include <jvmfwk/framework.hxx> +#include <i18nlangtag/languagetag.hxx> #include "jni.h" #include <stack> @@ -368,28 +369,25 @@ void getDefaultLocaleFromConfig( // read locale css::uno::Reference<css::registry::XRegistryKey> locale = xRegistryRootKey->openKey("L10N/ooLocale"); if(locale.is() && !locale->getStringValue().isEmpty()) { + LanguageTag aLanguageTag( locale->getStringValue()); OUString language; + OUString script; OUString country; + // Java knows nothing but plain old ISO language and country codes. + aLanguageTag.getIsoLanguageScriptCountry( language, script, country); - sal_Int32 index = locale->getStringValue().indexOf((sal_Unicode) '-'); + if(!language.isEmpty()) { + OUString prop = "user.language=" + + language; - if(index >= 0) { - language = locale->getStringValue().copy(0, index); - country = locale->getStringValue().copy(index + 1); - - if(!language.isEmpty()) { - OUString prop = "user.language=" - + language; - - pjvm->pushProp(prop); - } + pjvm->pushProp(prop); + } - if(!country.isEmpty()) { - OUString prop = "user.country=" - + country; + if(!country.isEmpty()) { + OUString prop = "user.country=" + + country; - pjvm->pushProp(prop); - } + pjvm->pushProp(prop); } } |