Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
build
base.pot
*~
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(ENABLE_TEST "Build Test" On)

find_package(Gettext REQUIRED)
find_package(Fcitx5Core 5.1.12 REQUIRED)
if (NOT TARGET Fcitx5::Core)
# Build as an independent project.
find_package(Fcitx5Core 5.1.12 REQUIRED)
include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
endif()
find_package(Boost 1.83 REQUIRED)

include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
add_compile_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-beast\")
fcitx5_add_i18n_definition()

add_subdirectory(src)
add_subdirectory(po)

if (ENABLE_TEST)
enable_testing()
Expand Down
1 change: 1 addition & 0 deletions po/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fcitx5_install_translation(fcitx5-beast)
2 changes: 2 additions & 0 deletions po/LINGUAS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zh_CN
zh_TW
37 changes: 37 additions & 0 deletions po/zh_CN.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Chinese translations for fcitx package.
# Copyright (C) 2025 THE fcitx'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx package.
# Qijia Liu <[email protected]>, 2025.
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx 5-beast\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-27 11:26-0500\n"
"PO-Revision-Date: 2025-12-27 12:05-0500\n"
"Last-Translator: Qijia Liu <[email protected]>\n"
"Language-Team: Chinese (simplified) <[email protected]>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/beast.h:30
msgid "Port"
msgstr "端口"

#: src/beast.h:34
msgid "Path"
msgstr "路径"

#: src/beast.h:46
msgid "Communication"
msgstr "通信"

#: src/beast.conf.in.in:2
msgid "Web server"
msgstr "Web 服务器"

#: src/beast.conf.in.in:3
msgid "Interact with fcitx5 via HTTP, powered by Boost.Beast"
msgstr "通过 HTTP 与 fcitx5 交互,基于 Boost.Beast"
37 changes: 37 additions & 0 deletions po/zh_TW.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Chinese translations for fcitx package.
# Copyright (C) 2025 THE fcitx'S COPYRIGHT HOLDER
# This file is distributed under the same license as the fcitx package.
# Qijia Liu <[email protected]>, 2025.
#
msgid ""
msgstr ""
"Project-Id-Version: fcitx 5-beast\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-12-27 11:26-0500\n"
"PO-Revision-Date: 2025-12-27 12:06-0500\n"
"Last-Translator: Qijia Liu <[email protected]>\n"
"Language-Team: Chinese (traditional) <[email protected]>\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/beast.h:30
msgid "Port"
msgstr "連接埠"

#: src/beast.h:34
msgid "Path"
msgstr "路徑"

#: src/beast.h:46
msgid "Communication"
msgstr "通訊"

#: src/beast.conf.in.in:2
msgid "Web server"
msgstr "Web 伺服器"

#: src/beast.conf.in.in:3
msgid "Interact with fcitx5 via HTTP, powered by Boost.Beast"
msgstr "透過 HTTP 與 fcitx5 互動,由 Boost.Beast 驅動"
8 changes: 8 additions & 0 deletions scripts/translate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

xgettext --c++ --keyword=_ --keyword=N_ src/beast.h -o po/base.pot
xgettext --language=Desktop src/beast.conf.in.in -j -o po/base.pot

while read -r line; do
msgmerge -U po/$line.po po/base.pot
done < po/LINGUAS
11 changes: 6 additions & 5 deletions src/beast.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ FCITX_CONFIGURATION(BeastUnixSocketConfig,
DEFAULT_UNIX_SOCKET_PATH};);

enum class BeastCommunication { UnixSocket, TCP };
FCITX_CONFIG_ENUM_NAME_WITH_I18N(BeastCommunication,
FCITX_CONFIG_ENUM_NAME(BeastCommunication,
#ifdef FCITX5_BEAST_HAS_UNIX_SOCKET
N_("Unix Socket"),
"Unix Socket",
#endif
N_("TCP"));
"TCP");

FCITX_CONFIGURATION(BeastConfig,
Option<BeastCommunication> communication{
Expand All @@ -53,10 +53,10 @@ FCITX_CONFIGURATION(BeastConfig,
#ifdef FCITX5_BEAST_HAS_UNIX_SOCKET
Option<BeastUnixSocketConfig> unix_socket{this,
"Unix Socket",
_("Unix Socket"),
"Unix Socket",
{}};
#endif
Option<BeastTcpConfig> tcp{this, "TCP", _("TCP"), {}};);
Option<BeastTcpConfig> tcp{this, "TCP", "TCP", {}};);

extern ConfigGetter configGetter_;
extern ConfigSetter configSetter_;
Expand Down Expand Up @@ -91,6 +91,7 @@ class Beast : public AddonInstance {
class BeastFactory : public AddonFactory {
public:
AddonInstance *create(AddonManager *manager) override {
registerDomain("fcitx5-beast", FCITX_INSTALL_LOCALEDIR);
return new Beast(manager->instance());
}
};
Expand Down