[glib/glib.fixtools.i18n: 1/2] build: Determine the appropriate string for setlocale()



commit 4bdc95bc204cbe5b0cb6e7bfe96234e58b20d729
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Wed Jun 5 16:34:57 2019 +0800

    build: Determine the appropriate string for setlocale()
    
    On Windows, in particular the CRTs on and after Visual Studio 2012, it
    is not enough just to do setlocale (LC_ALL, "") to set the default
    system locale, which results in the tools that use the translated
    messages to show unreadable messages when running the commmand line
    tools.
    
    This adds an entry in glibconfig.h.in which denotes the appropriate
    string to use for setlocale() to set the default system locale by
    setting it to ".ACP" if we are building via Visual Studio and "" for
    other compilers (as we are doing now).
    
    The tools in gio/ will be updated in the next commit to make use of this
    entry so that the translated messages can be shown correctly.

 glib/glibconfig.h.in | 2 ++
 meson.build          | 6 ++++++
 2 files changed, 8 insertions(+)
---
diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in
index 2bf6c43c1..2a4662c4a 100644
--- a/glib/glibconfig.h.in
+++ b/glib/glibconfig.h.in
@@ -209,6 +209,8 @@ typedef @g_pid_type@ GPid;
 #define G_SEARCHPATH_SEPARATOR '@g_searchpath_separator@'
 #define G_SEARCHPATH_SEPARATOR_S "@g_searchpath_separator@"
 
+#define GLIB_SYSTEM_DEFAULT_ANSI_CODEPAGE "@glib_system_default_ansi_codepage@"
+
 G_END_DECLS
 
 #endif /* __GLIBCONFIG_H__ */
diff --git a/meson.build b/meson.build
index da6822521..35b68559d 100644
--- a/meson.build
+++ b/meson.build
@@ -1690,6 +1690,12 @@ endif
 
 glibconfig_conf.set10('G_HAVE_GROWING_STACK', growing_stack)
 
+if host_system == 'windows' and cc.get_id() == 'msvc'
+  glibconfig_conf.set('glib_system_default_ansi_codepage', '.ACP')
+else
+  glibconfig_conf.set('glib_system_default_ansi_codepage', '')
+endif
+
 # Tests for iconv
 #
 # We should never use the MinGW C library's iconv because it may not be


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]