Use either lib/locale or share/locale depending on which one is in

2007-11-27  Tor Lillqvist  <tml@novell.com>

	* glib/gutils.c (_glib_get_locale_dir) [Win32]: Use either
	lib/locale or share/locale depending on which one is in
	GLIB_LOCALE_DIR. When the configury recognizes GNU gettext (based
	on the _nl_msg_cat_cntr variable, eek), share/locale gets used.

	* glib-zip.in: Likewise, look for message catalogs either in
	lib/locale or share/locale.


svn path=/trunk/; revision=5944
This commit is contained in:
Tor Lillqvist
2007-11-26 22:32:12 +00:00
committed by Tor Lillqvist
parent 13195ef836
commit 007d3ad28a
3 changed files with 43 additions and 16 deletions

View File

@@ -3136,29 +3136,37 @@ _g_utils_thread_init (void)
/**
* _glib_get_locale_dir:
*
* Return the path to the lib\locale subfolder of the GLib
* installation folder. The path is in the system codepage. We have to
* use system codepage as bindtextdomain() doesn't have a UTF-8
* interface.
* Return the path to the share\locale or lib\locale subfolder of the
* GLib installation folder. The path is in the system codepage. We
* have to use system codepage as bindtextdomain() doesn't have a
* UTF-8 interface.
*/
static gchar *
_glib_get_locale_dir (void)
{
gchar *dir, *cp_dir;
gchar *install_dir, *locale_dir;
gchar *retval = NULL;
dir = g_win32_get_package_installation_directory (GETTEXT_PACKAGE, dll_name);
cp_dir = g_win32_locale_filename_from_utf8 (dir);
g_free (dir);
install_dir = g_win32_get_package_installation_directory (GETTEXT_PACKAGE, dll_name);
if (cp_dir)
if (install_dir)
{
/* Don't use g_build_filename() on pathnames in the system
* codepage. In CJK locales cp_dir might end with a double-byte
* character whose trailing byte is a backslash.
/*
* Append "/share/locale" or "/lib/locale" depending on whether
* autoconfigury detected GNU gettext or not.
*/
retval = g_strconcat (cp_dir, "\\lib\\locale", NULL);
g_free (cp_dir);
const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR);
while (*--p != '/')
;
while (*--p != '/')
;
locale_dir = g_build_filename (install_dir, p, NULL);
retval = g_win32_locale_filename_from_utf8 (locale_dir);
g_free (install_dir);
g_free (locale_dir);
}
if (retval)