Comment #6 on issue 1188 by [email protected]: Cannot use cangjie for traditional Chinese if desktop language is set to English
http://code.google.com/p/ibus/issues/detail?id=1188

It seems to me like the proposed patch won't be enough to fix this issue.

Indeed, the proposed patch will do the following:
  +        __dict = {'cm0':0,'cm1':1,'cm2':2,'cm3':3,'cm4':4,'cm5':5}
  +        __lang = self.get_ime_property ('languages')

For Cangjie 5, __lang will be "zh_TW,zh_HK,zh_CN,zh_SG".

  +        if __lang:
  +            __langs = __lang.split(',')

Still for Cangjie 5, __langs will be ["zh_TW", "zh_HK", "zh_CN", "zh_SG"], none of which are among the keys in __dict.

  +            for _l in __langs:
  +                if _l.lower() in __dict:
  +                    return __dict[_l.lower()]
  +        return -1

And so this function will always return -1 for Cangjie 5.

So at the very least, something is missing to fix this bug: adding the appropriate value to the actual DB file.

It has been suggested in issue 1472 that the default chinese mode for Cangjie 5 should be 3 (all Chinese characters, but Traditional Chinese first, which makes sense as Cangjie is mostly used to input Traditional Chinese).

So the DB file must be modified so that the following line:
  +        __lang = self.get_ime_property ('languages')

, returns "cm3,zh_TW,zh_HK,zh_CN,zh_SG". (the order doesn't matter but writing it first makes the function a tiny little bit faster)

1. Wouldn't that interfere with the two places where this same function is called with the same parameter in engine/main.py?
    First:
            language = self.__factory.db.get_ime_property ("languages")
            [... snip ...]
            self.__component.add_engine(name,
                                        longname,
                                        description,
                                        language,
                                        license,
                                        author,
                                        icon,
                                        layout)

    Then:
            _langs = _sq_db.get_ime_property ('languages')
            if _langs:
                _langs = _langs.split (',')
                if len (_langs) == 1:
                    _language.text = _langs[0].strip()
                else:
                    # we ignore the place
                    _language.text = _langs[0].strip().split('_')[0]

It seems to me like adding 'cm3' to the DB file would impact the above two pieces of the code, and they should be modified as well to "filter out" this value. (but I'm not that familiar with IBus, so I might be wrong).

2. If there is no interference, may I suggest that 'cm3' be also added (and thus made the default chinese mode) for Cangjie 3, Quick 3 and Quick 5? Those share the same characteristics as Cangjie 5 (designed for both Traditional and Simplified Chinese, used mostly to input Traditional Chinese), and as such their users would benefit from the same default.

--
You received this message because you are subscribed to the Google
Groups "ibus-devel" group.
iBus project web page: http://code.google.com/p/ibus/
iBus dev group: http://groups.google.com/group/ibus-devel?hl=en

回复