Fix accidental switch/teleporter behavior changes
[neverball] / share / lang.c
index e2968a4..999c239 100644 (file)
@@ -22,6 +22,7 @@
 #include "lang.h"
 #include "common.h"
 #include "base_config.h"
+#include "fs.h"
 
 /*---------------------------------------------------------------------------*/
 
 void lang_init(const char *domain)
 {
 #if ENABLE_NLS
-    char *dir = getenv("NEVERBALL_LOCALE");
+    char *dir = strdup(getenv("NEVERBALL_LOCALE"));
 
     if (!dir)
-        dir = path_resolve(config_exec_path, CONFIG_LOCALE);
+    {
+        if (path_is_abs(CONFIG_LOCALE))
+            dir = strdup(CONFIG_LOCALE);
+        else
+            dir = concat_string(fs_base_dir(), "/", CONFIG_LOCALE, NULL);
+    }
 
     errno = 0;
 
@@ -52,6 +58,8 @@ void lang_init(const char *domain)
     bindtextdomain(domain, dir);
     bind_textdomain_codeset(domain, DEFAULT_CODESET);
     textdomain(domain);
+
+    free(dir);
 #else
     return;
 #endif