Skip to content

Commit

Permalink
import fcitx/mozc
Browse files Browse the repository at this point in the history
  • Loading branch information
shitamo committed Oct 22, 2024
1 parent 08d54de commit b81a098
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 62 deletions.
9 changes: 4 additions & 5 deletions src/unix/fcitx/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ mozc_cc_library(
"//base:vlog",
"//client:client",
"//protocol:commands_cc_proto",
"@com_google_absl//absl/log:check",
]
)

Expand All @@ -43,7 +42,6 @@ mozc_cc_library(
"//base:vlog",
"//protocol:commands_cc_proto",
"//client:client_interface",
"@com_google_absl//absl/log:check",
],
)

Expand All @@ -59,11 +57,11 @@ mozc_cc_library(
],
deps = [
"//base:port",
"//base:singleton",
"//base:singleton",
"//base:vlog",
"//protocol:config_cc_proto",
"//protocol:commands_cc_proto",
"@com_google_absl//absl/log:check",
"@fcitx//:fcitx",
],
)

Expand All @@ -79,7 +77,7 @@ mozc_cc_library(
"//base:util",
"//base:port",
"//base:vlog",
"@com_google_absl//absl/log:check",
"@fcitx//:fcitx",
],
)

Expand All @@ -89,6 +87,7 @@ mozc_cc_binary(
deps = [
":fcitx_mozc",
"//base:init_mozc",
"@fcitx//:fcitx",
],
local_defines = [
'LOCALEDIR=\\"/usr/share/locale\\"',
Expand Down
8 changes: 4 additions & 4 deletions src/unix/fcitx/mozc_response_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ bool MozcResponseParser::ParseResponse(const mozc::commands::Output &response,

// Then show the candidate window.
if (response.has_candidates()) {
const mozc::commands::Candidates &candidates = response.candidates();
const mozc::commands::CandidateWindow &candidates = response.candidates();
ParseCandidates(candidates, fcitx_mozc);
}

Expand Down Expand Up @@ -242,7 +242,7 @@ static boolean FcitxMozcPaging(void* arg, boolean prev)
}

void MozcResponseParser::ParseCandidates(
const mozc::commands::Candidates &candidates, FcitxMozc *fcitx_mozc) const {
const mozc::commands::CandidateWindow &candidates, FcitxMozc *fcitx_mozc) const {
const commands::Footer &footer = candidates.footer();
bool hasPrev = false;
bool hasNext = false;
Expand Down Expand Up @@ -287,7 +287,7 @@ void MozcResponseParser::ParseCandidates(
FcitxCandidateWordReset(candList);
FcitxCandidateWordSetPageSize(candList, 9);
if (candidates.has_direction() &&
candidates.direction() == commands::Candidates::HORIZONTAL) {
candidates.direction() == commands::CandidateWindow::HORIZONTAL) {
FcitxCandidateWordSetLayoutHint(candList, CLH_Horizontal);
} else {
FcitxCandidateWordSetLayoutHint(candList, CLH_Vertical);
Expand All @@ -314,7 +314,7 @@ void MozcResponseParser::ParseCandidates(
focused_index = candidates.focused_index();
}
for (int i = 0; i < candidates.candidate_size(); ++i) {
const commands::Candidates::Candidate& candidate = candidates.candidate(i);
const commands::CandidateWindow::Candidate& candidate = candidates.candidate(i);
const uint32_t index = candidate.index();
FcitxMessageType type;
if (focused_index != -1 && index == focused_index) {
Expand Down
4 changes: 2 additions & 2 deletions src/unix/fcitx/mozc_response_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace mozc
namespace commands
{

class Candidates;
class CandidateWindow;
class Input;
class Output;
class Preedit;
Expand Down Expand Up @@ -81,7 +81,7 @@ class MozcResponseParser
void ExecuteCallback(const mozc::commands::Output& response, FcitxMozc* fcitx_mozc) const;
void ParseResult ( const mozc::commands::Result &result,
FcitxMozc *fcitx_mozc ) const;
void ParseCandidates ( const mozc::commands::Candidates &candidates,
void ParseCandidates ( const mozc::commands::CandidateWindow &candidates,
FcitxMozc *fcitx_mozc ) const;
void ParsePreedit ( const mozc::commands::Preedit &preedit,
uint32_t position,
Expand Down
2 changes: 2 additions & 0 deletions src/unix/fcitx5/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ mozc_cc_library(
hdrs = ["mozc_client_pool.h"],
deps = [
":mozc_connection",
"//client:client_interface",
"@fcitx5//:fcitx5",
]
)
Expand Down Expand Up @@ -65,6 +66,7 @@ mozc_cc_library(
"//base:run_level",
"//base:util",
"//base:vlog",
"//protocol:candidates_cc_proto",
"//protocol:commands_cc_proto",
"//client:client_interface",
"@fcitx5//:fcitx5",
Expand Down
8 changes: 4 additions & 4 deletions src/unix/fcitx5/mozc_response_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class MozcCandidateWord final : public CandidateWord {
class MozcCandidateList final : public CandidateList,
public PageableCandidateList {
public:
MozcCandidateList(const mozc::commands::Candidates &candidates,
MozcCandidateList(const mozc::commands::CandidateWindow &candidates,
InputContext *ic, MozcEngine *engine, bool use_annotation)
: ic_(ic), engine_(engine) {
auto *state = engine_->mozcState(ic);
Expand Down Expand Up @@ -145,7 +145,7 @@ class MozcCandidateList final : public CandidateList,
labels_.reserve(candidates.candidate_size());

for (int i = 0; i < candidates.candidate_size(); ++i) {
const mozc::commands::Candidates::Candidate &candidate =
const mozc::commands::CandidateWindow::Candidate &candidate =
candidates.candidate(i);
const uint32_t index = candidate.index();

Expand Down Expand Up @@ -393,7 +393,7 @@ bool MozcResponseParser::ParseResponse(const mozc::commands::Output &response,

// Then show the candidate window.
if (response.has_candidates()) {
const mozc::commands::Candidates &candidates = response.candidates();
const mozc::commands::CandidateWindow &candidates = response.candidates();
ParseCandidates(candidates, ic);
}

Expand Down Expand Up @@ -423,7 +423,7 @@ void MozcResponseParser::ParseResult(const mozc::commands::Result &result,
}

void MozcResponseParser::ParseCandidates(
const mozc::commands::Candidates &candidates, InputContext *ic) const {
const mozc::commands::CandidateWindow &candidates, InputContext *ic) const {
auto *mozc_state = engine_->mozcState(ic);
const mozc::commands::Footer &footer = candidates.footer();
if (candidates.has_footer()) {
Expand Down
17 changes: 3 additions & 14 deletions src/unix/fcitx5/mozc_response_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,8 @@

#include <cstdint>

#include "base/port.h"

namespace mozc {
namespace commands {

class Candidates;
class Input;
class Output;
class Preedit;
class Result;

} // namespace commands
} // namespace mozc
#include "protocol/candidates.pb.h"
#include "protocol/commands.pb.h"

namespace fcitx {

Expand Down Expand Up @@ -76,7 +65,7 @@ class MozcResponseParser {
InputContext *ic) const;
void ParseResult(const mozc::commands::Result &result,
InputContext *ic) const;
void ParseCandidates(const mozc::commands::Candidates &candidates,
void ParseCandidates(const mozc::commands::CandidateWindow &candidates,
InputContext *ic) const;
void ParsePreedit(const mozc::commands::Preedit &preedit, uint32_t position,
InputContext *ic) const;
Expand Down
4 changes: 4 additions & 0 deletions src/unix/fcitx5/org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<url type="vcs-browser">https://github.com/fcitx/mozc</url>
<project_group>Fcitx</project_group>
<releases>
<release version="2.30.5618.102" date="2024-10-10"></release>
<release version="2.30.5595.102" date="2024-09-17"></release>
<release version="2.30.5544.102" date="2024-08-28"></release>
<release version="2.30.5490.102" date="2024-06-06"></release>
<release version="2.30.5448.102" date="2024-04-25"></release>
<release version="2.30.5432.102" date="2024-04-06"></release>
<release version="2.29.5400.102" date="2024-03-07"></release>
Expand Down
66 changes: 33 additions & 33 deletions src/unix/fcitx5/po/zh_TW.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
# csslayer <[email protected]>, 2017
# bruh, 2020
# Neko ◣ 0xFF, 2022
# Lau YeeYu, 2023
# rocka, 2023
# Yiyu Liu, 2023
# Kisaragi Hiu <[email protected]>, 2024
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx5-mozc\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2023-10-30 20:24+0000\n"
"POT-Creation-Date: 2024-07-08 20:24+0000\n"
"PO-Revision-Date: 2017-11-23 05:28+0000\n"
"Last-Translator: rocka, 2023\n"
"Last-Translator: Kisaragi Hiu <[email protected]>, 2024\n"
"Language-Team: Chinese (Taiwan) (https://app.transifex.com/fcitx/teams/12005/"
"zh_TW/)\n"
"Language: zh_TW\n"
Expand All @@ -24,121 +24,121 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"

#: mozc_engine.h:94 mozc_engine.cc:198
#: mozc_engine.h:107 mozc_engine.cc:209
msgid "About Mozc"
msgstr "關於 Mozc"

#: mozc_engine.h:92 mozc_engine.cc:191
#: mozc_engine.h:105 mozc_engine.cc:202
msgid "Add Word"
msgstr "添加單詞"

#: mozc_engine.h:52
#: mozc_engine.h:65
msgid "All"
msgstr "所有"

#: mozc_engine.h:55
#: mozc_engine.h:68
msgid "Always"
msgstr "總是"

#: mozc_engine.h:88 mozc_engine.cc:175
#: mozc_engine.h:101 mozc_engine.cc:186
msgid "Configuration Tool"
msgstr "設定工具"

#: mozc_engine.h:90 mozc_engine.cc:183
#: mozc_engine.h:103 mozc_engine.cc:194
msgid "Dictionary Tool"
msgstr "字典工具"

#: mozc_engine.h:58 mozc_engine.cc:54
#: mozc_engine.h:71 mozc_engine.cc:65
msgid "Direct"
msgstr "直接鍵盤輸入"

#: mozc_engine.h:79
#: mozc_engine.h:92
msgid "Expand Usage (Requires vertical candidate list)"
msgstr "擴展使用 (需要垂直候選列表)"

#: mozc_engine.h:83
#: mozc_engine.h:96
msgid "Fix embedded preedit cursor at the beginning of the preedit"
msgstr "將嵌入預編輯文本的光標固定於開頭"
msgstr "將內嵌預編輯游標位置固定在預編輯的開頭"

#: mozc_engine.h:52
#: mozc_engine.h:65
msgid "Follow Global Configuration"
msgstr "跟隨全域配置"

#. Full width ASCII letter A.
#: mozc_engine.h:60 mozc_engine.cc:84
#: mozc_engine.h:73 mozc_engine.cc:95
msgid "Full ASCII"
msgstr "全形 ASCII"

#. Katakana letter A.
#: mozc_engine.h:59 mozc_engine.cc:68
#: mozc_engine.h:72 mozc_engine.cc:79
msgid "Full Katakana"
msgstr "全形片假名"

#: mozc_engine.h:59 mozc_engine.cc:76
#: mozc_engine.h:72 mozc_engine.cc:87
msgid "Half ASCII"
msgstr "半形 ASCII"

#. Half width Katakana letter A.
#: mozc_engine.h:60 mozc_engine.cc:91
#: mozc_engine.h:73 mozc_engine.cc:102
msgid "Half Katakana"
msgstr "半形片假名"

#. Hiragana letter A in UTF-8.
#: mozc_engine.h:58 mozc_engine.cc:61
#: mozc_engine.h:71 mozc_engine.cc:72
msgid "Hiragana"
msgstr "平假名"

#: mozc_engine.h:56
#: mozc_engine.h:69
msgid "Hotkey"
msgstr "快捷鍵"

#: mozc_engine.h:85
#: mozc_engine.h:98
msgid "Hotkey to expand usage"
msgstr "擴展使用的快捷鍵"
msgstr "展開用法的快捷鍵"

#: mozc_engine.h:70
#: mozc_engine.h:83
msgid "Initial Mode"
msgstr "初始模式"

#: org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in:8
msgid "Japanese input method based on Mozc"
msgstr "基於 Mozc 的日語輸入法"

#: mozc_engine.cc:147 mozc_engine.cc:148
#: mozc_engine.cc:158 mozc_engine.cc:159
msgid "Mozc Settings"
msgstr "Mozc 設定"

#: org.fcitx.Fcitx5.Addon.Mozc.metainfo.xml.in:7
msgid "Mozc for Fcitx 5"
msgstr "Fcitx 5 的 Mozc 支援"

#: mozc_engine.h:53
#: mozc_engine.h:66
msgid "No"
msgstr "否"

#: mozc_engine.h:55
#: mozc_engine.h:68
msgid "On Focus"
msgstr "選中時"
msgstr "聚焦時"

#. We don't have a good library option for this, just do the simple
#. replace. absl's runtime parsed format string is too copmlex.
#: mozc_response_parser.cc:175
#: mozc_response_parser.cc:189
#, c-format
msgid "Press %s to show usages."
msgstr "按下 %s 顯示用法。"

#: mozc_state.cc:425
#: mozc_state.cc:462
msgid "Press Escape to go back"
msgstr "按下 Escape 返回"

#: mozc_engine.h:53
#: mozc_engine.h:66
msgid "Program"
msgstr "程式"

#: mozc_engine.h:73
#: mozc_engine.h:86
msgid "Shared Input State"
msgstr "共享輸入狀態"

#: mozc_engine.h:75
#: mozc_engine.h:88
msgid "Vertical candidate list"
msgstr "垂直候選字列表"

0 comments on commit b81a098

Please sign in to comment.