Revert "Revert "Resolves: #i86470# Wrong Java locale when using "nl" and "fr"""
This reverts commit4c13c4da16
, after475e4b477c
"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>
This commit is contained in:
@@ -16,6 +16,7 @@ $(eval $(call gb_Library_use_udk_api,javavm))
|
||||
$(eval $(call gb_Library_use_libraries,javavm,\
|
||||
cppu \
|
||||
cppuhelper \
|
||||
i18nlangtag \
|
||||
jvmaccess \
|
||||
jvmfwk \
|
||||
sal \
|
||||
|
@@ -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);
|
||||
pjvm->pushProp(prop);
|
||||
}
|
||||
|
||||
if(!language.isEmpty()) {
|
||||
OUString prop = "user.language="
|
||||
+ language;
|
||||
if(!country.isEmpty()) {
|
||||
OUString prop = "user.country="
|
||||
+ country;
|
||||
|
||||
pjvm->pushProp(prop);
|
||||
}
|
||||
|
||||
if(!country.isEmpty()) {
|
||||
OUString prop = "user.country="
|
||||
+ country;
|
||||
|
||||
pjvm->pushProp(prop);
|
||||
}
|
||||
pjvm->pushProp(prop);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user