Example #1
0
char* ChttransOutputFilter(void* arg, const char *strin)
{
    FcitxChttrans* transState = (FcitxChttrans*) arg;
    FcitxIM* im = FcitxInstanceGetCurrentIM(transState->owner);

    /* don't trans for "zh" */
    if (!im || strncmp(im->langCode, "zh", 2) != 0 || strlen(im->langCode) == 2)
        return NULL;

    if (ChttransEnabled(transState)) {
        if (strcmp(im->langCode, "zh_HK") == 0 ||
            strcmp(im->langCode, "zh_TW") == 0) {
            return NULL;
        } else {
            return ConvertGBKSimple2Tradition(transState, strin);
        }
    } else {
        if (strcmp(im->langCode, "zh_CN") == 0) {
            return NULL;
        } else {
            return ConvertGBKTradition2Simple(transState, strin);
        }
    }
    return NULL;
}
Example #2
0
void* ChttransT2S(void* arg, FcitxModuleFunctionArg args)
{
    FcitxChttrans* transState = (FcitxChttrans*) arg;
    const char* s = args.args[0];

    return ConvertGBKTradition2Simple(transState, s);
}