]> git.sesse.net Git - vlc/commitdiff
Win32: fix gettext with non-ASCII installation path
authorRémi Denis-Courmont <remi@remlab.net>
Mon, 24 Jan 2011 16:32:10 +0000 (18:32 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Mon, 24 Jan 2011 16:32:52 +0000 (18:32 +0200)
Note that this only works if the path can be represented in the ANSI
code page. Otherwise, you will need to patch gettext.

src/modules/textdomain.c

index 4d7e54e75fe51c217b6c47a6ef1a3b20b55f65c8..96a0072823de2be95ea6ca595c651f2b2a97be06 100644 (file)
@@ -29,6 +29,7 @@
 # include <libintl.h>
 # if defined (__APPLE__) || defined (WIN32)
 #  include "config/configuration.h"
+#  include <vlc_charset.h>
 # endif
 #endif
 
@@ -41,13 +42,15 @@ int vlc_bindtextdomain (const char *domain)
 # if !defined (__APPLE__) && !defined (WIN32)
     static const char path[] = LOCALEDIR;
 # else
-    char *datadir = config_GetDataDirDefault();
-    char *path;
+    char *path = config_GetDataDirDefault();
+    char *buf;
 
-    if (unlikely(datadir == NULL))
+    if (unlikely(path == NULL))
         return -1;
-    ret = asprintf (&path, "%s" DIR_SEP "locale", datadir);
-    free (datadir);
+    ret = asprintf (&buf, "%s" DIR_SEP "locale", path);
+    free (path);
+    path = ToLocaleDup (buf);
+    free (buf);
 # endif
 
     if (bindtextdomain (domain, path) == NULL)