Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ports the dictionary lookup feature to the fcitx5 version #103

Merged
merged 11 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ jobs:
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt install -y pkg-config
apt install -y clang
apt install -y cmake extra-cmake-modules gettext libfmt-dev
apt install -y fcitx5 libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev
apt install -y libjson-c-dev
- name: Build
run: |
mkdir -p build
Expand All @@ -42,10 +44,11 @@ jobs:
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt install -y pkg-config
apt install -y clang
apt install -y cmake extra-cmake-modules gettext libfmt-dev
apt install -y fcitx5 libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev
apt install -y libicu-dev
apt install -y libicu-dev libjson-c-dev
- name: Build
run: |
mkdir -p build
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ project(fcitx5-mcbopomofo VERSION 2.5.2)
find_package(ECM REQUIRED 1.0.0)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

find_package(PkgConfig REQUIRED)
find_package(Fcitx5Core REQUIRED)
find_package(Fcitx5Utils REQUIRED)
find_package(fmt REQUIRED)
find_package(Gettext REQUIRED)

pkg_check_modules(JSONC REQUIRED IMPORTED_TARGET "json-c")

include(FeatureSummary)
include(GNUInstallDirs)
include(ECMSetupVersion)
Expand Down Expand Up @@ -58,9 +61,11 @@ message(STATUS "CMAKE_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}")
configure_file(data/data.txt mcbopomofo-data.txt)
configure_file(data/data-plain-bpmf.txt mcbopomofo-data-plain-bpmf.txt)
configure_file(data/add-phrase-hook.sh mcbopomofo-add-phrase-hook.sh)
configure_file(data/dictionary_service.json mcbopomofo-dictionary-service.json)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mcbopomofo-data.txt" DESTINATION "${FCITX_INSTALL_PKGDATADIR}/data")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mcbopomofo-data-plain-bpmf.txt" DESTINATION "${FCITX_INSTALL_PKGDATADIR}/data")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mcbopomofo-add-phrase-hook.sh" DESTINATION "${FCITX_INSTALL_PKGDATADIR}/data")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/mcbopomofo-dictionary-service.json" DESTINATION "${FCITX_INSTALL_PKGDATADIR}/data")

fcitx5_translate_desktop_file(org.fcitx.Fcitx5.Addon.McBopomofo.metainfo.xml.in
org.fcitx.Fcitx5.Addon.McBopomofo.metainfo.xml XML
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

```bash
sudo apt install \
fcitx5 libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev \
cmake extra-cmake-modules gettext libfmt-dev libicu-dev
pkg-config fcitx5 libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev \
cmake extra-cmake-modules gettext libfmt-dev libicu-dev libjson-c-dev
```

然後在本專案的 git 目錄下執行以下指令:
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

rm -rf build
mkdir -p build
# rm -rf build
# mkdir -p build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug # use Debug for easy debugging with gdb
make # or ninja, depending on your system
Expand Down
56 changes: 56 additions & 0 deletions data/dictionary_service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"services": [
{
"name": "萌典",
"url_template": "https://www.moedict.tw/(encoded)"
},
{
"name": "萌典 (台語)",
"url_template": "https://www.moedict.tw/'(encoded)"
},
{
"name": "萌典 (客語)",
"url_template": "https://www.moedict.tw/:(encoded)"
},
{
"name": "Google",
"url_template": "https://www.google.com/search?q=(encoded)"
},
{
"name": "教育部重編國語詞典修訂本",
"url_template": "https://dict.revised.moe.edu.tw/search.jsp?md=1&word=(encoded)"
},
{
"name": "教育部國語詞典簡編本",
"url_template": "https://dict.concised.moe.edu.tw/search.jsp?md=1&word=(encoded)"
},
{
"name": "教育部成語典",
"url_template": "https://dict.idioms.moe.edu.tw/idiomList.jsp?idiom=(encoded)&qMd=0&qTp=1&qTp=2"
},
{
"name": "教育部異體字字典",
"url_template": "https://dict.variants.moe.edu.tw/variants/rbt/query_result.do?from=standard&search_text=(encoded)"
},
{
"name": "教育部國字標準字體筆順學習網",
"url_template": "https://stroke-order.learningweb.moe.edu.tw/charactersQueryResult.do?words=(encoded)&lang=zh_TW&csrfPreventionSalt=null"
},
{
"name": "教育部臺灣閩南語常用詞辭典",
"url_template": "https://sutian.moe.edu.tw/zh-hant/tshiau/?lui=tai_su&tsha=(encoded)"
},
{
"name": "Wiktionary",
"url_template": "https://zh.wiktionary.org/wiki/Special:Search?search=(encoded)"
},
{
"name": "康熙字典網上版",
"url_template": "https://www.kangxizidian.com/search/index.php?stype=Word&sword=(encoded)&detail=n"
},
{
"name": "Unihan Database",
"url_template": "https://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=(encoded)"
}
]
}
79 changes: 49 additions & 30 deletions po/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: fcitx5-mcbopomofo v0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-30 10:34+0800\n"
"POT-Creation-Date: 2023-12-31 21:14+0800\n"
"PO-Revision-Date: 2022-03-22 20:28-0700\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand All @@ -17,83 +17,91 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: src/McBopomofo.cpp:129
#: src/McBopomofo.cpp:164
msgid "Cursor is between syllables {0} and {1}"
msgstr ""

#: src/McBopomofo.cpp:134
#: src/McBopomofo.cpp:169
msgid "{0} syllables required"
msgstr ""

#: src/McBopomofo.cpp:138
#: src/McBopomofo.cpp:173
msgid "{0} syllables maximum"
msgstr ""

#: src/McBopomofo.cpp:142
#: src/McBopomofo.cpp:177
msgid "phrase already exists"
msgstr ""

#: src/McBopomofo.cpp:146
#: src/McBopomofo.cpp:181
msgid "press Enter to add the phrase"
msgstr ""

#: src/McBopomofo.cpp:152
#: src/McBopomofo.cpp:187
msgid "Marked: {0}, syllables: {1}, {2}"
msgstr ""

#: src/McBopomofo.cpp:164
#: src/McBopomofo.cpp:199
msgid "# Custom Phrases or Characters."
msgstr ""

#: src/McBopomofo.cpp:166
#: src/McBopomofo.cpp:201
msgid ""
"# See https://github.com/openvanilla/McBopomofo/wiki/使用手冊#手動加詞 for "
"usage."
msgstr ""

#: src/McBopomofo.cpp:168
#: src/McBopomofo.cpp:203
msgid ""
"# Add your phrases and their respective Bopomofo reading below. Use hyphen "
"(\"-\")"
msgstr ""

#: src/McBopomofo.cpp:169
#: src/McBopomofo.cpp:204
msgid "# to connect the Bopomofo syllables."
msgstr ""

#: src/McBopomofo.cpp:173 src/McBopomofo.cpp:192
#: src/McBopomofo.cpp:208 src/McBopomofo.cpp:227
msgid "# Any line that starts with \"#\" is treated as comment."
msgstr ""

#: src/McBopomofo.cpp:182
#: src/McBopomofo.cpp:217
msgid "# Custom Excluded Phrases or Characters."
msgstr ""

#: src/McBopomofo.cpp:184
#: src/McBopomofo.cpp:219
msgid ""
"# See https://github.com/openvanilla/McBopomofo/wiki/使用手冊#手動刪詞 for "
"usage."
msgstr ""

#: src/McBopomofo.cpp:186
#: src/McBopomofo.cpp:221
msgid ""
"# For example, the line below will prevent the phrase \"家祠\" from showing "
"up anywhere:"
msgstr ""

#: src/McBopomofo.cpp:190
#: src/McBopomofo.cpp:225
msgid ""
"# Note that you need to use a hyphen (\"-\") between Bopomofo syllables."
msgstr ""

#: src/McBopomofo.cpp:231
#: src/McBopomofo.cpp:266
msgid "Edit User Phrases"
msgstr ""

#: src/McBopomofo.cpp:241
#: src/McBopomofo.cpp:276
msgid "Edit Excluded Phrases"
msgstr ""

#: src/McBopomofo.cpp:876
msgid "UTF8 String Length: {0}"
msgstr ""

#: src/McBopomofo.cpp:879
msgid "Code Point Count: {0}"
msgstr ""

#: src/McBopomofo.h:59
msgid "standard"
msgstr "Standard"
Expand Down Expand Up @@ -172,46 +180,54 @@ msgstr "Input HTML Ruby Text"

#: src/McBopomofo.h:98
msgid "Bopomofo Keyboard Layout"
msgstr ""
msgstr "Bopomofo Keyboard Layout"

#: src/McBopomofo.h:104
msgid "Candidate List Layout"
msgstr ""
msgstr "Candidate List Layout"

#: src/McBopomofo.h:109
msgid "Selection Keys"
msgstr ""
msgstr "Selection Keys"

#: src/McBopomofo.h:114
msgid "Show Candidate Phrase"
msgstr "Show Candidates"

#: src/McBopomofo.h:119
msgid "Move cursor after selection"
msgstr ""
msgstr "Move cursor after selection"

#: src/McBopomofo.h:125
msgid "ESC key clears entire composing buffer"
msgstr ""
msgstr "ESC key clears entire composing buffer"

#: src/McBopomofo.h:129
msgid "Shift + Letter Keys"
msgstr ""
msgstr "Shift + Letter Keys"

#: src/McBopomofo.h:135
msgid "Control + Enter Key"
msgstr ""
msgstr "Control + Enter Key"

#: src/McBopomofo.h:140
msgid "Open User Phrase Files With"
msgstr ""
msgstr "Open User Phrase Files With"

#: src/McBopomofo.h:145
msgid "Add Phrase Hook Path"
msgstr ""
msgstr "Add Phrase Hook Path"

#: src/McBopomofo.h:150
msgid "Run the hook script after adding a phrase"
msgstr "Run the hook script after adding a phrase"

#: src/DictionaryService.cpp:37 src/DictionaryService.cpp:55
msgid "Character Information"
msgstr ""

#: src/DictionaryService.cpp:76
msgid "Look up \"{0}\" in {1}"
msgstr ""

#: src/mcbopomofo.conf.in.in:3 src/mcbopomofo-addon.conf.in.in:3
Expand All @@ -225,13 +241,16 @@ msgstr "Plain Bopomofo"

#: src/mcbopomofo-addon.conf.in.in:4
msgid "McBopomofo Input Method For Fcitx"
msgstr ""
msgstr "McBopomofo Input Method For Fcitx"

#: org.fcitx.Fcitx5.Addon.McBopomofo.metainfo.xml.in:7
#, fuzzy
msgid "McBopomofo for Fcitx 5"
msgstr "Plain Bopomofo"
msgstr "McBopomofo for Fcitx 5"

#: org.fcitx.Fcitx5.Addon.McBopomofo.metainfo.xml.in:8
msgid "A Bopomofo input method that picks phrases intelligently"
msgstr ""
msgstr "A Bopomofo input method that picks phrases intelligently"

#~ msgid "Open URL With"
#~ msgstr "Open URL With"
Loading