Date: Friday, November 7, 2014 @ 06:34:28 Author: fyan Revision: 122137
archrelease: copy trunk to community-staging-i686, community-staging-x86_64 Added: fcitx/repos/community-staging-i686/ fcitx/repos/community-staging-i686/PKGBUILD (from rev 122136, fcitx/trunk/PKGBUILD) fcitx/repos/community-staging-i686/custom-translation-install-dir.patch (from rev 122136, fcitx/trunk/custom-translation-install-dir.patch) fcitx/repos/community-staging-i686/fcitx-gtk2.install (from rev 122136, fcitx/trunk/fcitx-gtk2.install) fcitx/repos/community-staging-i686/fcitx-gtk3.install (from rev 122136, fcitx/trunk/fcitx-gtk3.install) fcitx/repos/community-staging-i686/fcitx.install (from rev 122136, fcitx/trunk/fcitx.install) fcitx/repos/community-staging-i686/opencc-1.0.patch (from rev 122136, fcitx/trunk/opencc-1.0.patch) fcitx/repos/community-staging-x86_64/ fcitx/repos/community-staging-x86_64/PKGBUILD (from rev 122136, fcitx/trunk/PKGBUILD) fcitx/repos/community-staging-x86_64/custom-translation-install-dir.patch (from rev 122136, fcitx/trunk/custom-translation-install-dir.patch) fcitx/repos/community-staging-x86_64/fcitx-gtk2.install (from rev 122136, fcitx/trunk/fcitx-gtk2.install) fcitx/repos/community-staging-x86_64/fcitx-gtk3.install (from rev 122136, fcitx/trunk/fcitx-gtk3.install) fcitx/repos/community-staging-x86_64/fcitx.install (from rev 122136, fcitx/trunk/fcitx.install) fcitx/repos/community-staging-x86_64/opencc-1.0.patch (from rev 122136, fcitx/trunk/opencc-1.0.patch) ---------------------------------------------------------------+ community-staging-i686/PKGBUILD | 109 ++++++++++ community-staging-i686/custom-translation-install-dir.patch | 33 +++ community-staging-i686/fcitx-gtk2.install | 11 + community-staging-i686/fcitx-gtk3.install | 11 + community-staging-i686/fcitx.install | 14 + community-staging-i686/opencc-1.0.patch | 53 ++++ community-staging-x86_64/PKGBUILD | 109 ++++++++++ community-staging-x86_64/custom-translation-install-dir.patch | 33 +++ community-staging-x86_64/fcitx-gtk2.install | 11 + community-staging-x86_64/fcitx-gtk3.install | 11 + community-staging-x86_64/fcitx.install | 14 + community-staging-x86_64/opencc-1.0.patch | 53 ++++ 12 files changed, 462 insertions(+) Copied: fcitx/repos/community-staging-i686/PKGBUILD (from rev 122136, fcitx/trunk/PKGBUILD) =================================================================== --- community-staging-i686/PKGBUILD (rev 0) +++ community-staging-i686/PKGBUILD 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,109 @@ +# $Id$ +# Maintainer: Felix Yan <felixonm...@archlinux.org> +# Contributor: Andrea Scarpino <and...@archlinux.org> +# Contributor: csslayer <wengxt AT gmail com> + +pkgbase=fcitx +pkgname=('fcitx' 'fcitx-gtk2' 'fcitx-gtk3' 'fcitx-qt4') +pkgver=4.2.8.5 +pkgrel=6 +groups=('fcitx-im') +arch=('i686' 'x86_64') +url="http://fcitx-im.org" +license=('GPL' 'LGPL') +makedepends=('cmake' 'doxygen' 'gtk2' 'gtk3' 'qt4' 'icu' 'mesa' 'opencc' \ + 'iso-codes' 'gobject-introspection' 'libxkbfile' 'enchant' 'python2') +source=(http://download.fcitx-im.org/$pkgbase/$pkgbase-${pkgver}_dict.tar.xz + custom-translation-install-dir.patch + opencc-1.0.patch) +sha512sums=('ee6612a34087135065537fa14f09078bad9f029f69b636fb2221193f23d86c5431a9d8a848b264bdcb259680f6bda41d08d58dcf67d19e5a200cb11fa4a26ffe' + 'c57ef118b72accdfc42a0035a5318bf4b0ebe082af46efff7bfea4b063d382cc92bef0205555e42d140a6ffcbbdb87d43db833e1a221c5d3a97f12c8720e759a' + 'f652e81e5a28107903b3a65601a507eace59aa147ffc19fa6471c902241110209dceb902d659de312c9b16e0efd1b2873316aca652534ba6fb27af81d9f4c08d') + +prepare() { + cd ${pkgbase}-${pkgver} + + patch -p1 -i ../custom-translation-install-dir.patch + patch -p1 -i ../opencc-1.0.patch +} + +build() { + mkdir -p build + cd build + + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSYSCONFDIR=/etc \ + -DFORCE_OPENCC=ON \ + -DFORCE_PRESAGE=ON \ + -DFORCE_ENCHANT=ON \ + -DENABLE_TEST=ON \ + -DENABLE_GTK2_IM_MODULE=ON \ + -DENABLE_GTK3_IM_MODULE=ON \ + -DENABLE_QT_IM_MODULE=ON \ + -DQT_QMAKE_EXECUTABLE=qmake-qt4 + make +} + +check() { + cd build + make test +} + +package_fcitx() { + pkgdesc="Flexible Context-aware Input Tool with eXtension" + depends=('pango' 'libxinerama' 'gtk-update-icon-cache' 'shared-mime-info' \ + 'hicolor-icon-theme' 'desktop-file-utils' 'libxkbfile' \ + 'libxfixes' 'dbus' 'icu') + optdepends=('enchant: for word predication support' + 'opencc: optional engine to do chinese convert' + 'gettext: for fcitx-po-parser') + install=fcitx.install + + cd build + make DESTDIR="${pkgdir}" install + + rm -r "${pkgdir}/usr/lib/"{gtk-2.0,gtk-3.0,qt4} + rm -r "${pkgdir}/usr/lib/fcitx/qt" + rm -r "${pkgdir}/usr/include/fcitx-qt" + rm "${pkgdir}/usr/lib/fcitx/libexec/fcitx-qt-gui-wrapper" + rm "${pkgdir}/usr/lib/"libfcitx-qt.so* + rm "${pkgdir}/usr/lib/pkgconfig/fcitx-qt.pc" +} + +package_fcitx-gtk2() { + pkgdesc='GTK2 IM Module for fcitx' + depends=('gtk2' "fcitx>=$pkgver") + install=fcitx-gtk2.install + + cd "${srcdir}/build/src/frontend/gtk2" + make DESTDIR="${pkgdir}" install +} + +package_fcitx-gtk3() { + pkgdesc='GTK3 IM Module for fcitx' + depends=('gtk3' "fcitx>=$pkgver") + install=fcitx-gtk3.install + + cd "${srcdir}/build/src/frontend/gtk3" + make DESTDIR="${pkgdir}" install +} + +package_fcitx-qt4() { + pkgdesc='Qt4 IM Module for fcitx' + depends=('qt4' "fcitx>=$pkgver") + replaces=('fcitx-qt') + provides=('fcitx-qt') + conflicts=('fcitx-qt') + + cd "${srcdir}/build/src/frontend/qt" + make DESTDIR="${pkgdir}" install + + cd "${srcdir}/build/tools/gui" + make DESTDIR="${pkgdir}" install + + cd "${srcdir}/build/src/lib/fcitx-qt" + make DESTDIR="${pkgdir}" install +} + Copied: fcitx/repos/community-staging-i686/custom-translation-install-dir.patch (from rev 122136, fcitx/trunk/custom-translation-install-dir.patch) =================================================================== --- community-staging-i686/custom-translation-install-dir.patch (rev 0) +++ community-staging-i686/custom-translation-install-dir.patch 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,33 @@ +From 7a75b84ea330af7f64bed1db34ce45ef10d0015c Mon Sep 17 00:00:00 2001 +From: Yichao Yu <yyc1...@gmail.com> +Date: Sun, 28 Sep 2014 10:00:53 -0400 +Subject: [PATCH] [cmake] add option for translation install dir + +--- + cmake/FcitxMacro.cmake | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/cmake/FcitxMacro.cmake b/cmake/FcitxMacro.cmake +index ca46497..05f3830 100644 +--- a/cmake/FcitxMacro.cmake ++++ b/cmake/FcitxMacro.cmake +@@ -638,6 +638,10 @@ function(fcitx_translate_add_apply_source in_file out_file) + "Cannot find a rule to convert ${in_file} to ${out_file}") + endfunction() + ++if(NOT DEFINED FCITX_PO_INSTALL_DIR) ++ set(FCITX_PO_INSTALL_DIR share/locale/) ++endif() ++ + # Should be used in cmake modules, add a handler script to update a set of + # certain type of files from the translated mo files. + # The script must be executable. +@@ -719,7 +723,7 @@ function(fcitx_translate_set_pot_target target domain pot_file) + -o "${po_dir}/${domain}.mo" "${po_file}" + DEPENDS "${po_file}") + install(FILES "${po_dir}/${domain}.mo" +- DESTINATION "share/locale/${po_lang}/LC_MESSAGES") ++ DESTINATION "${FCITX_PO_INSTALL_DIR}/${po_lang}/LC_MESSAGES") + list(APPEND all_mo_files "${po_dir}/${domain}.mo") + list(APPEND all_po_files "${po_file}") + endforeach() Copied: fcitx/repos/community-staging-i686/fcitx-gtk2.install (from rev 122136, fcitx/trunk/fcitx-gtk2.install) =================================================================== --- community-staging-i686/fcitx-gtk2.install (rev 0) +++ community-staging-i686/fcitx-gtk2.install 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,11 @@ +post_install() { + usr/bin/gtk-query-immodules-2.0 --update-cache +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} Copied: fcitx/repos/community-staging-i686/fcitx-gtk3.install (from rev 122136, fcitx/trunk/fcitx-gtk3.install) =================================================================== --- community-staging-i686/fcitx-gtk3.install (rev 0) +++ community-staging-i686/fcitx-gtk3.install 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,11 @@ +post_install() { + usr/bin/gtk-query-immodules-3.0 --update-cache +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} Copied: fcitx/repos/community-staging-i686/fcitx.install (from rev 122136, fcitx/trunk/fcitx.install) =================================================================== --- community-staging-i686/fcitx.install (rev 0) +++ community-staging-i686/fcitx.install 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,14 @@ +post_upgrade() { + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor + update-desktop-database -q + update-mime-database usr/share/mime &> /dev/null +} + +post_install() { + echo "You should at least install one of kcm-fcitx (For Qt/KDE users) or fcitx-configtool (For GTK+ users) to enable Fcitx configuration GUI." + post_upgrade +} + +post_remove() { + post_upgrade +} Copied: fcitx/repos/community-staging-i686/opencc-1.0.patch (from rev 122136, fcitx/trunk/opencc-1.0.patch) =================================================================== --- community-staging-i686/opencc-1.0.patch (rev 0) +++ community-staging-i686/opencc-1.0.patch 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,53 @@ +From 3b931e059ffa28066363cd53feae0221cf71714c Mon Sep 17 00:00:00 2001 +From: Weng Xuetian <wen...@gmail.com> +Date: Wed, 5 Nov 2014 13:11:23 -0500 +Subject: [PATCH] [chttrans] add support for new opencc + +--- + src/module/chttrans/chttrans-opencc.c | 26 ++++++++++++++++++++++++-- + 1 file changed, 24 insertions(+), 2 deletions(-) + +diff --git a/src/module/chttrans/chttrans-opencc.c b/src/module/chttrans/chttrans-opencc.c +index a6eb0cd..57ce03b 100644 +--- a/src/module/chttrans/chttrans-opencc.c ++++ b/src/module/chttrans/chttrans-opencc.c +@@ -6,8 +6,13 @@ + #include <stdlib.h> + #include <dlfcn.h> + +-#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "zhs2zht.ini" +-#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "zht2zhs.ini" ++#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD_OLD "zhs2zht.ini" ++#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP_OLD "zht2zhs.ini" ++ ++#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "s2t.json" ++#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "t2s.json" ++ ++ + static void* _opencc_handle = NULL; + static void* (*_opencc_open)(const char* config_file) = NULL; + static char* (*_opencc_convert_utf8)(void* opencc, const char* inbuf, size_t length) = NULL; +@@ -49,6 +54,23 @@ OpenCCInit(FcitxChttrans* transState) + return false; + transState->ods2t = _opencc_open(_OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD); + transState->odt2s = _opencc_open(_OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP); ++ ++ if (transState->ods2t == (void*) -1) { ++ transState->ods2t = _opencc_open(_OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD_OLD); ++ } ++ if (transState->odt2s == (void*) -1) { ++ transState->odt2s = _opencc_open(_OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP_OLD); ++ } ++ ++ // stupid opencc use -1 as failure ++ if (transState->ods2t == (void*) -1) { ++ transState->ods2t = NULL; ++ } ++ ++ if (transState->odt2s == (void*) -1) { ++ transState->odt2s = NULL; ++ } ++ + if (!transState->ods2t && !transState->odt2s) + return false; + return true; Copied: fcitx/repos/community-staging-x86_64/PKGBUILD (from rev 122136, fcitx/trunk/PKGBUILD) =================================================================== --- community-staging-x86_64/PKGBUILD (rev 0) +++ community-staging-x86_64/PKGBUILD 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,109 @@ +# $Id$ +# Maintainer: Felix Yan <felixonm...@archlinux.org> +# Contributor: Andrea Scarpino <and...@archlinux.org> +# Contributor: csslayer <wengxt AT gmail com> + +pkgbase=fcitx +pkgname=('fcitx' 'fcitx-gtk2' 'fcitx-gtk3' 'fcitx-qt4') +pkgver=4.2.8.5 +pkgrel=6 +groups=('fcitx-im') +arch=('i686' 'x86_64') +url="http://fcitx-im.org" +license=('GPL' 'LGPL') +makedepends=('cmake' 'doxygen' 'gtk2' 'gtk3' 'qt4' 'icu' 'mesa' 'opencc' \ + 'iso-codes' 'gobject-introspection' 'libxkbfile' 'enchant' 'python2') +source=(http://download.fcitx-im.org/$pkgbase/$pkgbase-${pkgver}_dict.tar.xz + custom-translation-install-dir.patch + opencc-1.0.patch) +sha512sums=('ee6612a34087135065537fa14f09078bad9f029f69b636fb2221193f23d86c5431a9d8a848b264bdcb259680f6bda41d08d58dcf67d19e5a200cb11fa4a26ffe' + 'c57ef118b72accdfc42a0035a5318bf4b0ebe082af46efff7bfea4b063d382cc92bef0205555e42d140a6ffcbbdb87d43db833e1a221c5d3a97f12c8720e759a' + 'f652e81e5a28107903b3a65601a507eace59aa147ffc19fa6471c902241110209dceb902d659de312c9b16e0efd1b2873316aca652534ba6fb27af81d9f4c08d') + +prepare() { + cd ${pkgbase}-${pkgver} + + patch -p1 -i ../custom-translation-install-dir.patch + patch -p1 -i ../opencc-1.0.patch +} + +build() { + mkdir -p build + cd build + + cmake ../${pkgbase}-${pkgver} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSYSCONFDIR=/etc \ + -DFORCE_OPENCC=ON \ + -DFORCE_PRESAGE=ON \ + -DFORCE_ENCHANT=ON \ + -DENABLE_TEST=ON \ + -DENABLE_GTK2_IM_MODULE=ON \ + -DENABLE_GTK3_IM_MODULE=ON \ + -DENABLE_QT_IM_MODULE=ON \ + -DQT_QMAKE_EXECUTABLE=qmake-qt4 + make +} + +check() { + cd build + make test +} + +package_fcitx() { + pkgdesc="Flexible Context-aware Input Tool with eXtension" + depends=('pango' 'libxinerama' 'gtk-update-icon-cache' 'shared-mime-info' \ + 'hicolor-icon-theme' 'desktop-file-utils' 'libxkbfile' \ + 'libxfixes' 'dbus' 'icu') + optdepends=('enchant: for word predication support' + 'opencc: optional engine to do chinese convert' + 'gettext: for fcitx-po-parser') + install=fcitx.install + + cd build + make DESTDIR="${pkgdir}" install + + rm -r "${pkgdir}/usr/lib/"{gtk-2.0,gtk-3.0,qt4} + rm -r "${pkgdir}/usr/lib/fcitx/qt" + rm -r "${pkgdir}/usr/include/fcitx-qt" + rm "${pkgdir}/usr/lib/fcitx/libexec/fcitx-qt-gui-wrapper" + rm "${pkgdir}/usr/lib/"libfcitx-qt.so* + rm "${pkgdir}/usr/lib/pkgconfig/fcitx-qt.pc" +} + +package_fcitx-gtk2() { + pkgdesc='GTK2 IM Module for fcitx' + depends=('gtk2' "fcitx>=$pkgver") + install=fcitx-gtk2.install + + cd "${srcdir}/build/src/frontend/gtk2" + make DESTDIR="${pkgdir}" install +} + +package_fcitx-gtk3() { + pkgdesc='GTK3 IM Module for fcitx' + depends=('gtk3' "fcitx>=$pkgver") + install=fcitx-gtk3.install + + cd "${srcdir}/build/src/frontend/gtk3" + make DESTDIR="${pkgdir}" install +} + +package_fcitx-qt4() { + pkgdesc='Qt4 IM Module for fcitx' + depends=('qt4' "fcitx>=$pkgver") + replaces=('fcitx-qt') + provides=('fcitx-qt') + conflicts=('fcitx-qt') + + cd "${srcdir}/build/src/frontend/qt" + make DESTDIR="${pkgdir}" install + + cd "${srcdir}/build/tools/gui" + make DESTDIR="${pkgdir}" install + + cd "${srcdir}/build/src/lib/fcitx-qt" + make DESTDIR="${pkgdir}" install +} + Copied: fcitx/repos/community-staging-x86_64/custom-translation-install-dir.patch (from rev 122136, fcitx/trunk/custom-translation-install-dir.patch) =================================================================== --- community-staging-x86_64/custom-translation-install-dir.patch (rev 0) +++ community-staging-x86_64/custom-translation-install-dir.patch 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,33 @@ +From 7a75b84ea330af7f64bed1db34ce45ef10d0015c Mon Sep 17 00:00:00 2001 +From: Yichao Yu <yyc1...@gmail.com> +Date: Sun, 28 Sep 2014 10:00:53 -0400 +Subject: [PATCH] [cmake] add option for translation install dir + +--- + cmake/FcitxMacro.cmake | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/cmake/FcitxMacro.cmake b/cmake/FcitxMacro.cmake +index ca46497..05f3830 100644 +--- a/cmake/FcitxMacro.cmake ++++ b/cmake/FcitxMacro.cmake +@@ -638,6 +638,10 @@ function(fcitx_translate_add_apply_source in_file out_file) + "Cannot find a rule to convert ${in_file} to ${out_file}") + endfunction() + ++if(NOT DEFINED FCITX_PO_INSTALL_DIR) ++ set(FCITX_PO_INSTALL_DIR share/locale/) ++endif() ++ + # Should be used in cmake modules, add a handler script to update a set of + # certain type of files from the translated mo files. + # The script must be executable. +@@ -719,7 +723,7 @@ function(fcitx_translate_set_pot_target target domain pot_file) + -o "${po_dir}/${domain}.mo" "${po_file}" + DEPENDS "${po_file}") + install(FILES "${po_dir}/${domain}.mo" +- DESTINATION "share/locale/${po_lang}/LC_MESSAGES") ++ DESTINATION "${FCITX_PO_INSTALL_DIR}/${po_lang}/LC_MESSAGES") + list(APPEND all_mo_files "${po_dir}/${domain}.mo") + list(APPEND all_po_files "${po_file}") + endforeach() Copied: fcitx/repos/community-staging-x86_64/fcitx-gtk2.install (from rev 122136, fcitx/trunk/fcitx-gtk2.install) =================================================================== --- community-staging-x86_64/fcitx-gtk2.install (rev 0) +++ community-staging-x86_64/fcitx-gtk2.install 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,11 @@ +post_install() { + usr/bin/gtk-query-immodules-2.0 --update-cache +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} Copied: fcitx/repos/community-staging-x86_64/fcitx-gtk3.install (from rev 122136, fcitx/trunk/fcitx-gtk3.install) =================================================================== --- community-staging-x86_64/fcitx-gtk3.install (rev 0) +++ community-staging-x86_64/fcitx-gtk3.install 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,11 @@ +post_install() { + usr/bin/gtk-query-immodules-3.0 --update-cache +} + +post_upgrade() { + post_install +} + +post_remove() { + post_install +} Copied: fcitx/repos/community-staging-x86_64/fcitx.install (from rev 122136, fcitx/trunk/fcitx.install) =================================================================== --- community-staging-x86_64/fcitx.install (rev 0) +++ community-staging-x86_64/fcitx.install 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,14 @@ +post_upgrade() { + gtk-update-icon-cache -q -t -f usr/share/icons/hicolor + update-desktop-database -q + update-mime-database usr/share/mime &> /dev/null +} + +post_install() { + echo "You should at least install one of kcm-fcitx (For Qt/KDE users) or fcitx-configtool (For GTK+ users) to enable Fcitx configuration GUI." + post_upgrade +} + +post_remove() { + post_upgrade +} Copied: fcitx/repos/community-staging-x86_64/opencc-1.0.patch (from rev 122136, fcitx/trunk/opencc-1.0.patch) =================================================================== --- community-staging-x86_64/opencc-1.0.patch (rev 0) +++ community-staging-x86_64/opencc-1.0.patch 2014-11-07 05:34:28 UTC (rev 122137) @@ -0,0 +1,53 @@ +From 3b931e059ffa28066363cd53feae0221cf71714c Mon Sep 17 00:00:00 2001 +From: Weng Xuetian <wen...@gmail.com> +Date: Wed, 5 Nov 2014 13:11:23 -0500 +Subject: [PATCH] [chttrans] add support for new opencc + +--- + src/module/chttrans/chttrans-opencc.c | 26 ++++++++++++++++++++++++-- + 1 file changed, 24 insertions(+), 2 deletions(-) + +diff --git a/src/module/chttrans/chttrans-opencc.c b/src/module/chttrans/chttrans-opencc.c +index a6eb0cd..57ce03b 100644 +--- a/src/module/chttrans/chttrans-opencc.c ++++ b/src/module/chttrans/chttrans-opencc.c +@@ -6,8 +6,13 @@ + #include <stdlib.h> + #include <dlfcn.h> + +-#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "zhs2zht.ini" +-#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "zht2zhs.ini" ++#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD_OLD "zhs2zht.ini" ++#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP_OLD "zht2zhs.ini" ++ ++#define _OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "s2t.json" ++#define _OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "t2s.json" ++ ++ + static void* _opencc_handle = NULL; + static void* (*_opencc_open)(const char* config_file) = NULL; + static char* (*_opencc_convert_utf8)(void* opencc, const char* inbuf, size_t length) = NULL; +@@ -49,6 +54,23 @@ OpenCCInit(FcitxChttrans* transState) + return false; + transState->ods2t = _opencc_open(_OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD); + transState->odt2s = _opencc_open(_OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP); ++ ++ if (transState->ods2t == (void*) -1) { ++ transState->ods2t = _opencc_open(_OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD_OLD); ++ } ++ if (transState->odt2s == (void*) -1) { ++ transState->odt2s = _opencc_open(_OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP_OLD); ++ } ++ ++ // stupid opencc use -1 as failure ++ if (transState->ods2t == (void*) -1) { ++ transState->ods2t = NULL; ++ } ++ ++ if (transState->odt2s == (void*) -1) { ++ transState->odt2s = NULL; ++ } ++ + if (!transState->ods2t && !transState->odt2s) + return false; + return true;