[uim-commit] r1309 - branches/0.4/uim

tkng at freedesktop.org tkng at freedesktop.org
Wed Aug 24 14:16:33 PDT 2005


Author: tkng
Date: 2005-08-24 14:16:31 -0700 (Wed, 24 Aug 2005)
New Revision: 1309

Modified:
   branches/0.4/uim/iso-639-1.def
   branches/0.4/uim/m17nlib.c
   branches/0.4/uim/uim-util.c
   branches/0.4/uim/uim-util.h
Log:
* Merge from trunk (rev 1305 to 1208)

* uim/uim-util.c, uim/uim-util.h:
 -(uim_get_language_code_from_language_name): New function.

* uim/iso-639-1.def:
 - Added new entries for Myanmer, Bengali and Byelorussian.
 - Fixed a typo. Divehi -> Dhivehi.

* uim/m17nlib.c:
 -(remap_lang_name): This function is removed because it's no longer used.
 -(pushback_input_method): Call uim_get_language_code_from_language_name instead of
   remap_lang_name.



Modified: branches/0.4/uim/iso-639-1.def
===================================================================
--- branches/0.4/uim/iso-639-1.def	2005-08-24 20:32:59 UTC (rev 1308)
+++ branches/0.4/uim/iso-639-1.def	2005-08-24 21:16:31 UTC (rev 1309)
@@ -49,6 +49,7 @@
  {"ba",    N_("Bashkir")},
  {"eu",    N_("Basque")},
  {"bn",    N_("Bengali (Bangla)")},
+ {"bn",    N_("Bengali")},
  {"dz",    N_("Bhutani")},
  {"bh",    N_("Bihari")},
  {"bi",    N_("Bislama")}, 
@@ -56,6 +57,7 @@
  {"bg",    N_("Bulgarian")},
  {"my",    N_("Burmese")},
  {"be",    N_("Byelorussian (Belarusian)")},
+ {"be",    N_("Byelorussian")},
  {"km",    N_("Cambodian")},
  {"ca",    N_("Catalan")},
  {"la",    N_("Chewa")},
@@ -67,7 +69,7 @@
  {"hr",    N_("Croatian")},
  {"cs",    N_("Czech")},
  {"da",    N_("Danish")},
- {"dv",    N_("Divehi")},
+ {"dv",    N_("Dhivehi")},
  {"nl",    N_("Dutch")},
  {"en",    N_("English")},
  {"eo",    N_("Esperanto")},
@@ -125,6 +127,7 @@
  {"mr",    N_("Marathi")},
  {"mo",    N_("Moldavian")},
  {"mn",    N_("Mongolian")},
+ {"my",    N_("Myanmar")},
  {"na",    N_("Nauru")},
  {"ne",    N_("Nepali")},
  {"no",    N_("Norwegian")},

Modified: branches/0.4/uim/m17nlib.c
===================================================================
--- branches/0.4/uim/m17nlib.c	2005-08-24 20:32:59 UTC (rev 1308)
+++ branches/0.4/uim/m17nlib.c	2005-08-24 21:16:31 UTC (rev 1309)
@@ -36,6 +36,7 @@
 #include <string.h>
 #include <m17n.h>
 #include "uim-scm.h"
+#include "uim-util.h"
 #include "context.h"
 #include "plugin.h"
 
@@ -78,58 +79,11 @@
   return max_input_contexts - 1;
 }
 
-static char *
-remap_lang_name(char *lang)
-{
-  static struct lang_map_ {
-    char *lib_lang;
-    char *lang;
-  } lang_map[] = {
-    {"Japanese", "ja"},
-    {"Amharic", "am"},
-    {"Assamese", "as"},
-    {"Bengali", "bn"},
-    {"Tibetan", "bo"},
-    {"Greek", "el"},
-    {"Arabic", "ar"},
-    /*    {"Farsi", ""},*/
-    {"Gujarati", "gu"},
-    {"Hebrew", "he"},
-    {"Hindi", "hi"},
-    {"Croatian", "hr"},
-    {"Kazakh", "kk"},
-    /*    {"Caombodia", ""},*/
-    {"Kannada", "kn"},
-    {"Korean", "ko"},
-    {"Laothian", "lo"},
-    {"Malayalam", "ml"},
-    {"Oriya", "or"},
-    {"Punjabi", "pa"},/* Panjabi ? */
-    {"Russian", "ru"},
-    {"Slovak", "sl"},/* Slovenia ? */
-    {"Serbian", "sr"},
-    {"Tamil", "ta"},
-    {"Telugu", "te"},
-    {"Thai", "th"},
-    {"Vietnamese", "vi"},
-    {"Chinese", "zh"},
-    {NULL, NULL}
-  };
-
-  struct lang_map_ *l;
-  for (l = lang_map; l->lib_lang; l++) {
-    if (!strcmp(lang, l->lib_lang)) {
-      return l->lang;
-    }
-  }
-  return NULL;
-}
-
 static void
 pushback_input_method(MInputMethod *im,
 		      char *lib_lang, char *name)
 {
-  char *lang = remap_lang_name(lib_lang);
+  char *lang = uim_get_language_code_from_language_name(lib_lang);
 
   im_array = realloc(im_array, 
 		     sizeof(struct im_) * (nr_input_methods + 1));

Modified: branches/0.4/uim/uim-util.c
===================================================================
--- branches/0.4/uim/uim-util.c	2005-08-24 20:32:59 UTC (rev 1308)
+++ branches/0.4/uim/uim-util.c	2005-08-24 21:16:31 UTC (rev 1309)
@@ -578,6 +578,18 @@
   return get_language_name_from_locale(localename);
 }
 
+const char *
+uim_get_language_code_from_language_name(const char *language_name)
+{
+  unsigned int i;
+  for (i = 0; i < NR_LOCALE_LANGUAGE; i++) {
+    if (strcmp(locale_language_table[i].language, language_name) == 0) {
+      return locale_language_table[i].locale;
+    }
+  }
+  return NULL;
+}
+
 static uim_lisp
 lang_code_to_lang_name_raw(uim_lisp code_)
 {

Modified: branches/0.4/uim/uim-util.h
===================================================================
--- branches/0.4/uim/uim-util.h	2005-08-24 20:32:59 UTC (rev 1308)
+++ branches/0.4/uim/uim-util.h	2005-08-24 21:16:31 UTC (rev 1309)
@@ -52,6 +52,9 @@
 const char *
 uim_get_language_name_from_locale(const char *localename);
 
+const char *
+uim_get_language_code_from_language_name(const char *language_name);
+
 int
 is_setugid(void);
 



More information about the uim-commit mailing list