[vlc-commits] textdomain: relocate localedir on other OSes

Rémi Denis-Courmont git at videolan.org
Sun Mar 11 21:30:27 CET 2018


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar  7 21:16:23 2018 +0200| [267da9a6de4c8fef3ecb210d9dcaf53834bc09da] | committer: Rémi Denis-Courmont

textdomain: relocate localedir on other OSes

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=267da9a6de4c8fef3ecb210d9dcaf53834bc09da
---

 src/modules/textdomain.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/modules/textdomain.c b/src/modules/textdomain.c
index 1fd79f9e32..a164878a37 100644
--- a/src/modules/textdomain.c
+++ b/src/modules/textdomain.c
@@ -27,30 +27,24 @@
 
 #ifdef ENABLE_NLS
 # include <libintl.h>
-# if defined (__APPLE__) || defined (_WIN32) || defined(__OS2__)
-#  include <vlc_charset.h>
-# endif
+# include <vlc_charset.h>
 #endif
 
 int vlc_bindtextdomain (const char *domain)
 {
 #if defined (ENABLE_NLS)
     /* Specify where to find the locales for current domain */
-# if !defined (__APPLE__) && !defined (_WIN32) && !defined(__OS2__)
-    static const char path[] = LOCALEDIR;
-
-    if (bindtextdomain (domain, path) == NULL)
-    {
-        fprintf (stderr, "%s: text domain not found in %s\n", domain, path);
-        return -1;
-    }
-# else
     char *datadir = config_GetDataDir();
     if (unlikely(datadir == NULL))
         return -1;
 
+# if !defined (__APPLE__) && !defined (_WIN32) && !defined(__OS2__)
+    const char *fmt = "%s/../locale";
+# else
+    const char *fmt = "%s"DIR_SEP"locale";
+# endif
     char *upath;
-    int ret = asprintf (&upath, "%s" DIR_SEP "locale", datadir);
+    int ret = asprintf(&upath, fmt, datadir);
     free (datadir);
     if (unlikely(ret == -1))
         return -1;
@@ -65,7 +59,6 @@ int vlc_bindtextdomain (const char *domain)
     }
     free (lpath);
     free (upath);
-# endif
 
     /* LibVLC wants all messages in UTF-8.
      * Unfortunately, we cannot ask UTF-8 for strerror_r(), strsignal_r()



More information about the vlc-commits mailing list