From: Christophe CURIS <[email protected]>

---
 src/WindowMaker.h |  3 +++
 src/main.c        | 24 +++++++++++-------------
 src/rootmenu.c    |  7 +++----
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/WindowMaker.h b/src/WindowMaker.h
index 8456fe7..4561576 100644
--- a/src/WindowMaker.h
+++ b/src/WindowMaker.h
@@ -461,6 +461,9 @@ extern struct wmaker_global_variables {
                wprog_state signal_state;
        } program;
 
+       /* locale to use. NULL==POSIX or C */
+       const char *locale;
+
 } w_global;
 
 extern unsigned int ValidModMask;
diff --git a/src/main.c b/src/main.c
index b4e768f..c7c8d40 100644
--- a/src/main.c
+++ b/src/main.c
@@ -78,8 +78,6 @@ unsigned int ValidModMask = 0xff;
 int inotifyFD;
 int inotifyWD;
 #endif
-/* locale to use. NULL==POSIX or C */
-char *Locale = NULL;
 
 int wScreenCount = 0;
 
@@ -706,7 +704,7 @@ static int real_main(int argc, char **argv)
                                        wwarning(_("too few arguments for %s"), 
argv[i - 1]);
                                        exit(0);
                                }
-                               Locale = argv[i];
+                               w_global.locale = argv[i];
                        } else if (strcmp(argv[i], "-display") == 0 || 
strcmp(argv[i], "--display") == 0) {
                                i++;
                                if (i >= argc) {
@@ -746,19 +744,19 @@ static int real_main(int argc, char **argv)
                check_defaults();
        }
 
-       if (Locale) {
-               setenv("LANG", Locale, 1);
+       if (w_global.locale) {
+               setenv("LANG", w_global.locale, 1);
        } else {
-               Locale = getenv("LC_ALL");
-               if (!Locale) {
-                       Locale = getenv("LANG");
+               w_global.locale = getenv("LC_ALL");
+               if (!w_global.locale) {
+                       w_global.locale = getenv("LANG");
                }
        }
 
        setlocale(LC_ALL, "");
 
-       if (!Locale || strcmp(Locale, "C") == 0 || strcmp(Locale, "POSIX") == 0)
-               Locale = NULL;
+       if (!w_global.locale || strcmp(w_global.locale, "C") == 0 || 
strcmp(w_global.locale, "POSIX") == 0)
+               w_global.locale = NULL;
 #ifdef I18N
        if (getenv("NLSPATH")) {
                bindtextdomain("WindowMaker", getenv("NLSPATH"));
@@ -786,11 +784,11 @@ static int real_main(int argc, char **argv)
        }
 #endif
 
-       if (Locale) {
+       if (w_global.locale) {
                char *ptr;
 
-               Locale = wstrdup(Locale);
-               ptr = strchr(Locale, '.');
+               w_global.locale = wstrdup(w_global.locale);
+               ptr = strchr(w_global.locale, '.');
                if (ptr)
                        *ptr = 0;
        }
diff --git a/src/rootmenu.c b/src/rootmenu.c
index 64939f7..62a03f7 100644
--- a/src/rootmenu.c
+++ b/src/rootmenu.c
@@ -60,7 +60,6 @@
 
 #define MAX_SHORTCUT_LENGTH 32
 
-extern char *Locale;
 extern WDDomain *WDRootMenu;
 extern Cursor wCursor[WCUR_LAST];
 
@@ -309,14 +308,14 @@ static char *getLocalizedMenuFile(const char *menu)
        char *buffer, *ptr, *locale;
        int len;
 
-       if (!Locale)
+       if (!w_global.locale)
                return NULL;
 
-       len = strlen(menu) + strlen(Locale) + 8;
+       len = strlen(menu) + strlen(w_global.locale) + 8;
        buffer = wmalloc(len);
 
        /* try menu.locale_name */
-       snprintf(buffer, len, "%s.%s", menu, Locale);
+       snprintf(buffer, len, "%s.%s", menu, w_global.locale);
        if (access(buffer, F_OK) == 0)
                return buffer;
 
-- 
1.8.4.rc3


-- 
To unsubscribe, send mail to [email protected].

Reply via email to