[banshee] [Windows] Fix gettext language selection
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Windows] Fix gettext language selection
- Date: Fri, 26 Mar 2010 22:33:48 +0000 (UTC)
commit 40b5f9ae902616fc17e5e19e0522eb3f4c091768
Author: Julien Moutte <julien fluendo com>
Date: Fri Mar 26 15:24:14 2010 -0700
[Windows] Fix gettext language selection
On Windows the display language is not detected by gettext
automatically. Applications like pidgin are not automatically
switching to your language - they stay in English (bgo#614057)
A fix is to set the LANG environment variable based on the
display language to force proper gettext translations.
Signed-off-by: Gabriel Burt <gabriel burt gmail com>
.../Banshee.ServiceStack/Application.cs | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs b/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
index 8fbc161..3d481fb 100644
--- a/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
+++ b/src/Core/Banshee.Services/Banshee.ServiceStack/Application.cs
@@ -30,6 +30,8 @@
using System;
using System.Reflection;
using System.Collections.Generic;
+using System.Globalization;
+using System.Runtime.InteropServices;
using Mono.Unix;
using Hyena;
@@ -78,10 +80,24 @@ namespace Banshee.ServiceStack
ServiceManager.DefaultInitialize ();
}
+#if WIN32
+ [DllImport("msvcrt.dll") /* willfully unmapped */]
+ public static extern int _putenv (string varName);
+#endif
+
public static void Run ()
{
Banshee.Base.PlatformHacks.TrapMonoJitSegv ();
+#if WIN32
+ // There are two sets of environement variables we need to impact with our LANG.
+ // refer to : http://article.gmane.org/gmane.comp.gnu.mingw.user/8272
+ CultureInfo current_ci = CultureInfo.CurrentUICulture;
+ string env = String.Concat ("LANG=", current_ci.TwoLetterISOLanguageName);
+ Environment.SetEnvironmentVariable ("LANG", current_ci.TwoLetterISOLanguageName);
+ _putenv (env);
+#endif
+
Catalog.Init (Application.InternalName, System.IO.Path.Combine (
Banshee.Base.Paths.InstalledApplicationDataRoot, "locale"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]