From 9eb919628fce98b5e7a8b3262d76a8b0e8cc01c4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 30 May 2017 12:27:08 +0100 Subject: make LANGUAGE setting universal, not just gtk specific MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I845e808be27e2fad959a73d0d34a204b4bdcdd1f Reviewed-on: https://gerrit.libreoffice.org/38211 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/source/app/svmain.cxx | 18 +++++++++++++++++- vcl/unx/gtk/gtkinst.cxx | 6 ------ 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 2a89d80f60f3..672618bd5712 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -313,10 +313,26 @@ bool InitVCL() new DesktopEnvironmentContext( css::uno::getCurrentContext() ) ); // Initialize application instance (should be done after initialization of VCL SAL part) - if( pSVData->mpApp ) + if (pSVData->mpApp) + { // call init to initialize application class // soffice/sfx implementation creates the global service manager pSVData->mpApp->Init(); + } + + if (pSVData->maAppData.mpSettings) + { + //Now that uno has been bootstrapped we can ask the config what the UI language is so that we can + //force that in as $LANGUAGE. That way we can get gtk to render widgets RTL + //if we have a RTL UI in an otherwise LTR locale and get gettext using externals (e.g. python) + //to match their translations to our preferred UI language + OUString aLocaleString(pSVData->maAppData.mpSettings->GetUILanguageTag().getGlibcLocaleString(".UTF-8")); + if (!aLocaleString.isEmpty()) + { + OUString envVar("LANGUAGE"); + osl_setEnvironment(envVar.pData, aLocaleString.pData); + } + } pSVData->mpDefInst->AfterAppInit(); diff --git a/vcl/unx/gtk/gtkinst.cxx b/vcl/unx/gtk/gtkinst.cxx index e01a267b6131..a22ea9c93f87 100644 --- a/vcl/unx/gtk/gtkinst.cxx +++ b/vcl/unx/gtk/gtkinst.cxx @@ -167,12 +167,6 @@ GtkInstance::GtkInstance( SalYieldMutex* pMutex ) //UI in a LTR locale void GtkInstance::AfterAppInit() { - OUString aLocaleString(Application::GetSettings().GetUILanguageTag().getGlibcLocaleString(".UTF-8")); - if (!aLocaleString.isEmpty()) - { - OUString envVar("LANGUAGE"); - osl_setEnvironment(envVar.pData, aLocaleString.pData); - } EnsureInit(); } -- cgit