Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


On Wed, Mar 06, 2013 at 04:50:43PM +0000, Caolán McNamara wrote:
On Wed, 2013-03-06 at 17:52 +0200, Khaled Hosny wrote:
The default direction of GTK widgets is locale dependant; it is set by a
string in GTK's gettext catalogue, so if we can somehow trick GTK to use
the same locale as LibreOffice UI, that would be a solution.

See SalGtkPicker::setGtkLanguage vcl/unx/gtk/fpicker/SalGtkPicker.cxx
Using LANGUAGE should get gettext to do the right thing without busting
any of the "normal" locale settings for us.

First thing to try would be to move that code out of there and get it
called before any gtk widgetery gets going. Try moving it into
GtkData::Init before that "gtk_set_locale" call and see it that
works/helps/does anything.

So I got fed up and tried this. Setting LANGUAGE in GtkData::Init()
indeed fixes the issue, but calling Application::GetSettings() there
throws a DeploymentException, apparently that code is executed too
early, before InitVCL() is called.

Regards,
Khaled
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 5ff5a80..87b3efd 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -603,6 +603,13 @@ void GtkData::Init()
     SAL_INFO( "vcl.gtk", "GtkMainloop::Init()" );
     XrmInitialize();
 
+    OUString 
aLocaleString(Application::GetSettings().GetUILanguageTag().getGlibcLocaleString(".UTF-8"));
+    if (!aLocaleString.isEmpty())
+    {
+        OUString envVar("LANGUAGE");
+        osl_setEnvironment(envVar.pData, aLocaleString.pData);
+    }
+
 #if !GTK_CHECK_VERSION(3,0,0)
     gtk_set_locale();
 #endif

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.