From 154f5fa750a2dc94c70af3c4306371978793ba57 Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 16 May 2007 06:19:36 +0000 Subject: [PATCH] *** empty log message *** --- po/ja.po | 45 +++++++++-------- src/mim-config.c | 147 +++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 125 insertions(+), 67 deletions(-) diff --git a/po/ja.po b/po/ja.po index 1195ac2..9be84e9 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: m17n-im-config 0.9.0\n" "Report-Msgid-Bugs-To: m17n-lib@m17n.org\n" -"POT-Creation-Date: 2007-05-07 11:21+0900\n" +"POT-Creation-Date: 2007-05-14 21:08+0900\n" "PO-Revision-Date: 2007-03-18 18:19+0900\n" "Last-Translator: Kenichi Handa \n" "Language-Team: Japanese \n" @@ -17,75 +17,76 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: src/mim-config.c:290 +#: src/mim-config.c:301 +#, fuzzy +msgid "Other" +msgstr "~¤½¤Î¾" + +#: src/mim-config.c:323 msgid "global" msgstr "¥°¥í¡¼¥Ð¥ë" -#: src/mim-config.c:313 -msgid "~other" -msgstr "~¤½¤Î¾" - -#: src/mim-config.c:687 src/mim-config.c:753 src/mim-config.c:1606 +#: src/mim-config.c:735 src/mim-config.c:800 src/mim-config.c:1656 msgid "Status" msgstr "¾õÂÖ" -#: src/mim-config.c:732 +#: src/mim-config.c:779 msgid "No customizable item." msgstr "Êѹ¹²Äǽ¤Ê¹àÌܤϤ¢¤ê¤Þ¤»¤ó¡£" -#: src/mim-config.c:750 +#: src/mim-config.c:797 msgid "Name" msgstr "̾Á°" -#: src/mim-config.c:796 +#: src/mim-config.c:844 msgid "_Variables" msgstr "ÊÑ¿ô (_V)" -#: src/mim-config.c:809 +#: src/mim-config.c:857 msgid "Co_mmands" msgstr "¥³¥Þ¥ó¥É (_m)" -#: src/mim-config.c:910 +#: src/mim-config.c:958 msgid "The value must be an integer." msgstr "ÃͤÏÀ°¿ô" -#: src/mim-config.c:972 src/mim-config.c:1578 +#: src/mim-config.c:1020 src/mim-config.c:1628 msgid "modified" msgstr "Êѹ¹¤µ¤ì¤Æ¤¤¤Þ¤¹" -#: src/mim-config.c:1142 src/mim-config.c:1230 +#: src/mim-config.c:1190 src/mim-config.c:1284 msgid "_Default" msgstr "¥Ç¥Õ¥©¥ë¥ÈÃÍ (_D)" -#: src/mim-config.c:1209 +#: src/mim-config.c:1259 msgid "Current key bindings:" msgstr "¸½ºß¤Î¥­¡¼¥Ð¥¤¥ó¥Ç¥£¥ó¥°:" -#: src/mim-config.c:1435 +#: src/mim-config.c:1485 msgid "New key binding:" msgstr "¿·¤·¤¤¥­¡¼¥Ð¥¤¥ó¥Ç¥£¥ó¥°:" -#: src/mim-config.c:1576 +#: src/mim-config.c:1626 msgid "default" msgstr "¥Ç¥Õ¥©¥ë¥ÈÃÍ" -#: src/mim-config.c:1577 +#: src/mim-config.c:1627 msgid "customized" msgstr "¥æ¡¼¥¶ÀßÄê" -#: src/mim-config.c:1579 +#: src/mim-config.c:1629 msgid "uncustomizable" msgstr "Êѹ¹ÉÔ²Ä" -#: src/mim-config.c:1581 +#: src/mim-config.c:1631 msgid "Value" msgstr "ÃÍ" -#: src/mim-config.c:1588 +#: src/mim-config.c:1638 msgid "Key Bindings" msgstr "¥­¡¼¥Ð¥¤¥ó¥Ç¥£¥ó¥°" -#: src/mim-config.c:1601 +#: src/mim-config.c:1651 msgid "Input Method" msgstr "ÆþÎϥ᥽¥Ã¥É" diff --git a/src/mim-config.c b/src/mim-config.c index 4992ec7..6c0e665 100644 --- a/src/mim-config.c +++ b/src/mim-config.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -247,6 +248,7 @@ tree_activated_cb (GtkTreeView *tree, GtkTreePath *path, typedef struct _MimTable { + gchar *lang_in_locale; gchar *lang; gchar *name; MSymbol symlang; @@ -258,7 +260,33 @@ sort_im (const void *p1, const void *p2) { const MimTable *t1 = p1; const MimTable *t2 = p2; - int result = strcmp (t1->lang, t2->lang); + int result; + + if (t1->symlang == t2->symlang) + result = 0; + else + { + if (t1->lang_in_locale) + { + if (t2->lang_in_locale) + result = strcoll (t1->lang_in_locale, t2->lang_in_locale); + else + result = -1; + } + else if (t2->lang_in_locale) + result = 1; + else if (t1->lang) + { + if (t2->lang) + result = strcmp (t1->lang, t2->lang); + else + result = -1; + } + else if (t2->lang) + result = 1; + else + result = 0; + } return (result ? result : strcmp (t1->name, t2->name)); } @@ -270,11 +298,17 @@ make_store_for_input_methods () MPlist *imlist, *p; int i; MimTable *imtable; - char *lang; + char *lang, *other = _("Other"); GtkTreeIter iter1, iter2; enum MimStatus status; MimConfigStatus *config_status; + unsigned char conv_buf[256]; + MConverter *converter; + int locale_is_utf8 = 0; + static MSymbol Meng; + if (! Meng) + Meng = msymbol ("eng"); store = gtk_tree_store_new (NUM_COLS, G_TYPE_STRING, /* COL_TAG */ G_TYPE_STRING, /* COL_STATUS_STR */ @@ -297,73 +331,96 @@ make_store_for_input_methods () imlist = mdatabase_list (msymbol ("input-method"), Mnil, Mnil, Mnil); config_status->num_im = mplist_length (imlist); imtable = g_newa (MimTable, config_status->num_im); + + { + MLocale *locale = mlocale_set (LC_MESSAGES, NULL); + MSymbol coding = locale ? mlocale_get_prop (locale, Mcoding) : Mnil; + + if (coding == Mnil) + converter = NULL; + else if (coding == msymbol ("utf-8")) + { + converter = NULL; + locale_is_utf8 = 1; + } + else + { + converter = mconv_buffer_converter (coding, conv_buf, sizeof conv_buf); + if (converter) + converter->last_block = 1; + } + } + for (i = 0, p = imlist; mplist_key (p) != Mnil; p = mplist_next (p)) { MDatabase *mdb = (MDatabase *) mplist_value (p); MSymbol *tag = mdatabase_tag (mdb); + MPlist *pl; + + if (tag[1] == Mnil || tag[2] == Mnil) + continue; - if (tag[1] != Mnil && tag[2] != Mnil) + imtable[i].symlang = tag[1]; + imtable[i].symname = tag[2]; + imtable[i].name = msymbol_name (tag[2]); + imtable[i].lang = imtable[i].lang_in_locale = NULL; + + if (tag[1] != Mt) { - MSymbol language = mlanguage_name (tag[1]); + pl = mlanguage_name_list (tag[1], Mnil); + if (! pl) + pl = mlanguage_name_list (tag[1], Meng); + if (pl) + { + MText *mt = mplist_value (pl); + int nbytes; - if (language != Mnil) - imtable[i].lang = msymbol_name (language); + if (converter) + { + mconv_reset_converter (converter); + nbytes = mconv_encode (converter, mt); + if (converter->result == MCONVERSION_RESULT_SUCCESS) + { + conv_buf[nbytes] = '\0'; + imtable[i].lang_in_locale = alloca (nbytes + 1); + if (imtable[i].lang_in_locale) + memcpy (imtable[i].lang_in_locale, conv_buf, + nbytes + 1); + } + } + else if (locale_is_utf8) + imtable[i].lang_in_locale + = mtext_data (mt, NULL, NULL, NULL, NULL); + imtable[i].lang = mtext_data (mt, NULL, NULL, NULL, NULL); + } else - /* `~' is for putting this element at the tail by sort. */ - imtable[i].lang = _("~other"); - imtable[i].name = msymbol_name (tag[2]); - imtable[i].symlang = tag[1]; - imtable[i].symname = tag[2]; - i++; + imtable[i].lang = msymbol_name (tag[1]); } + i++; } + if (converter) + mconv_free_converter (converter); m17n_object_unref (imlist); config_status->num_im = i; qsort (imtable, config_status->num_im, sizeof (MimTable), sort_im); for (lang = NULL, i = 0; i < config_status->num_im; i++) { - if (lang != imtable[i].lang) - { - gchar *name; + gchar *langname = imtable[i].lang; + if (! langname) + langname = other; + if (lang != langname) + { gtk_tree_store_append (store, &iter1, NULL); - lang = imtable[i].lang; - if (lang[0] != '~') - { - MText *native_text; - gchar *native = NULL; - int nbytes; - - if (imtable[i].symlang != Mt - && (native_text = mlanguage_text (imtable[i].symlang))) - { - enum MTextFormat fmt; - - native = mtext_data (native_text, &fmt, &nbytes, - NULL, NULL); - if (fmt != MTEXT_FORMAT_US_ASCII - && fmt != MTEXT_FORMAT_UTF_8) - native = 0; - } - if (0 && native) - { - name = alloca (strlen (lang) + nbytes + 4); - sprintf (name, "%s (%s)", lang, native); - } - else - name = lang; - } - else - name = lang + 1; - gtk_tree_store_set (store, &iter1, - COL_TAG, name, + COL_TAG, langname, COL_STATUS_STR, NULL, COL_STATUS, 0, COL_LANG, Mnil, COL_NAME, Mnil, -1); + lang = langname; } gtk_tree_store_append (store, &iter2, &iter1); gtk_tree_store_set (store, &iter2, -- 1.7.10.4