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
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to