summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2015-07-03 11:24:26 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2015-07-03 11:24:26 +0900
commit3397fcabe28f6cbf19b698954f5260fed11261c6 (patch)
tree445333f31021eac33ea292aef0e23b6079e4266a
parent845528b91bbccd691d75c931b1dffa304424831b (diff)
downloadibus-3397fcabe28f6cbf19b698954f5260fed11261c6.tar.gz
Use LC_CTYPE in IBusEngineSimple until g_get_language_names() is fixed
Review URL: https://codereview.appspot.com/249490043
-rw-r--r--src/ibusenginesimple.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/ibusenginesimple.c b/src/ibusenginesimple.c
index 3158a7e0..8413d32f 100644
--- a/src/ibusenginesimple.c
+++ b/src/ibusenginesimple.c
@@ -32,10 +32,6 @@
#include "ibuscomposetable.h"
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
#include <memory.h>
#include <stdlib.h>
@@ -936,12 +932,21 @@ gboolean
ibus_engine_simple_add_table_by_locale (IBusEngineSimple *simple,
const gchar *locale)
{
- const gchar * const *langs = NULL;
- const gchar * const *l = NULL;
+ const gchar *_locale = locale;
+ gchar **langs = NULL;
+ gchar **l = NULL;
gchar *path = NULL;
- if (locale == NULL) {
- langs = g_get_language_names ();
+ if (_locale == NULL) {
+ _locale = g_getenv ("LC_CTYPE");
+ if (_locale == NULL) {
+ _locale = g_getenv ("LANG");
+ }
+ if (_locale == NULL) {
+ _locale = "C";
+ }
+ /* FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=751826 */
+ langs = g_get_locale_variants (_locale);
for (l = langs; *l; l++) {
if (g_str_has_prefix (*l, "en_US"))
break;
@@ -953,6 +958,7 @@ ibus_engine_simple_add_table_by_locale (IBusEngineSimple *simple,
g_free (path);
path = NULL;
}
+ g_strfreev (langs);
} else {
path = g_build_filename (X11_DATADIR, locale, "Compose", NULL);
do {