2016-09-16 13:10:58 +02:00
|
|
|
---
|
|
|
|
locale.c | 21 ++++++++++++++++-----
|
|
|
|
1 file changed, 16 insertions(+), 5 deletions(-)
|
|
|
|
|
2010-02-18 12:17:29 +01:00
|
|
|
--- locale.c
|
2019-01-09 14:08:47 +01:00
|
|
|
+++ locale.c 2018-09-20 08:14:41.307485537 +0000
|
|
|
|
@@ -55,6 +55,7 @@ extern int dump_translatable_strings, du
|
2008-12-03 16:18:51 +01:00
|
|
|
|
|
|
|
/* The current locale when the program begins */
|
|
|
|
static char *default_locale;
|
|
|
|
+static char fallback[128];
|
|
|
|
|
|
|
|
/* The current domain for textdomain(3). */
|
|
|
|
static char *default_domain;
|
2021-01-11 13:18:34 +01:00
|
|
|
@@ -359,11 +360,21 @@ get_locale_var (var)
|
2008-12-03 16:18:51 +01:00
|
|
|
if (locale == 0 || *locale == 0)
|
|
|
|
locale = lang;
|
|
|
|
if (locale == 0 || *locale == 0)
|
2009-03-03 18:12:53 +01:00
|
|
|
-#if 0
|
2008-12-03 16:18:51 +01:00
|
|
|
- locale = default_locale; /* system-dependent; not really portable. should it be "C"? */
|
2009-03-03 18:12:53 +01:00
|
|
|
-#else
|
|
|
|
- locale = "";
|
|
|
|
-#endif
|
2008-12-03 16:18:51 +01:00
|
|
|
+ {
|
|
|
|
+ char *ptr;
|
|
|
|
+ if (default_locale && *default_locale && (ptr = strstr(default_locale, var)) && (ptr = strchr(ptr, '=')) && ++ptr)
|
|
|
|
+ {
|
|
|
|
+ memset (fallback, 0, sizeof(fallback));
|
|
|
|
+ strncpy(fallback, ptr, sizeof(fallback)-1);
|
2009-03-03 18:12:53 +01:00
|
|
|
+
|
2008-12-03 16:18:51 +01:00
|
|
|
+ if ((ptr = strchr(fallback, ';')))
|
|
|
|
+ *ptr = '\0';
|
2009-03-03 18:12:53 +01:00
|
|
|
+
|
2008-12-03 16:18:51 +01:00
|
|
|
+ locale = fallback;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ locale = default_locale; /* system-dependent; not really portable. should it be "C"? */
|
|
|
|
+ }
|
|
|
|
return (locale);
|
|
|
|
}
|
2009-03-03 18:12:53 +01:00
|
|
|
|