diff --git a/.gitignore b/.gitignore index aa535eb..1e18106 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ build # Auto-generated data assets/en.lproj/Localizable.strings -assets/po/base.pot +*.pot meta.swift *~ version.json diff --git a/CMakeLists.txt b/CMakeLists.txt index bb016f1..79bc29c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,6 +106,7 @@ add_subdirectory(fcitx5-beast/src) add_subdirectory(src) add_subdirectory(assets) +add_subdirectory(po) enable_testing() add_subdirectory(tests) diff --git a/README.md b/README.md index e7f1e3c..12b3a84 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ English [Fcitx5](https://github.com/fcitx/fcitx5) input method framework ported to macOS. -Please download [installer](https://github.com/fcitx-contrib/fcitx5-macos-installer). +Please download [installer](https://github.com/fcitx-contrib/fcitx5-macos-installer) and read [documentation](https://fcitx-contrib.github.io/docs/). ## Build Native build on Intel and Apple Silicon is supported. This is NOT an Xcode project, -but Xcode is needed for Swift compiler. +but Xcode >= 26 is needed for Swift compiler. ### Install dependencies You may use [nvm](https://github.com/nvm-sh/nvm) @@ -98,14 +98,14 @@ cmake --build build/$(uname -m) --target pot To add a new language, do ```sh -cd assets/po && msginit -l +cd po && msginit -l ``` Then, use a PO file editor to translate strings. Finally, to merge new strings into PO files, do ```sh -cd assets/po && msgmerge -U .po base.pot +cd po && msgmerge -U .po base.pot ``` ## Credits diff --git a/README.zh-CN.md b/README.zh-CN.md index 545a4b1..c9c711f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,4 +6,4 @@ [Fcitx5](https://github.com/fcitx/fcitx5) 输入框架的 macOS 移植。 -请下载[安装器](https://github.com/fcitx-contrib/fcitx5-macos-installer/blob/master/README.zh-CN.md)。 +请下载[安装器](https://github.com/fcitx-contrib/fcitx5-macos-installer/blob/master/README.zh-CN.md)并阅读[文档](https://fcitx-contrib.github.io/docs/)。 diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index 4753f61..5690576 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -89,5 +89,3 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Base.lproj" foreach(LPROJ_DIR IN LISTS LPROJ_DIRS) install(DIRECTORY "${LPROJ_DIR}" DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources") endforeach() - -add_subdirectory(po) diff --git a/assets/po/CMakeLists.txt b/po/CMakeLists.txt similarity index 77% rename from assets/po/CMakeLists.txt rename to po/CMakeLists.txt index 3406321..993c10f 100644 --- a/assets/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -8,11 +8,17 @@ set(TRANSLATABLE_CXX_SOURCES webpanel/webpanel.h ) +set(TRANSLATABLE_CONFIG_SOURCES + macosfrontend/macosfrontend.conf.in.in + macosnotifications/notifications.conf.in.in +) + list(TRANSFORM TRANSLATABLE_CXX_SOURCES PREPEND "${PROJECT_SOURCE_DIR}/" OUTPUT_VARIABLE TRANSLATABLE_CXX_SOURCES_FULL_PATH) add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/base.pot COMMAND xgettext --c++ --keyword=_ --keyword=N_ ${TRANSLATABLE_CXX_SOURCES} -o ${CMAKE_CURRENT_SOURCE_DIR}/base.pot + COMMAND xgettext --language=Desktop ${TRANSLATABLE_CONFIG_SOURCES} -j -o ${CMAKE_CURRENT_SOURCE_DIR}/base.pot DEPENDS ${TRANSLATABLE_CXX_SOURCES_FULL_PATH} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMENT "Generating base.pot..." diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..306a50d --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,2 @@ +zh_CN +zh_TW diff --git a/assets/po/zh_CN.po b/po/zh_CN.po similarity index 98% rename from assets/po/zh_CN.po rename to po/zh_CN.po index 510664a..9ecbcbf 100644 --- a/assets/po/zh_CN.po +++ b/po/zh_CN.po @@ -555,3 +555,11 @@ msgstr "尺寸" #: webpanel/webpanel.h:396 msgid "Advanced" msgstr "高级" + +#: macosfrontend/macosfrontend.conf.in.in:2 +msgid "macOS Frontend" +msgstr "macOS 前端" + +#: macosnotifications/notifications.conf.in.in:2 +msgid "macOS Notification" +msgstr "macOS 通知" diff --git a/assets/po/zh_TW.po b/po/zh_TW.po similarity index 98% rename from assets/po/zh_TW.po rename to po/zh_TW.po index 6ce1c47..e4b04b2 100644 --- a/assets/po/zh_TW.po +++ b/po/zh_TW.po @@ -555,3 +555,11 @@ msgstr "尺寸" #: webpanel/webpanel.h:396 msgid "Advanced" msgstr "進階" + +#: macosfrontend/macosfrontend.conf.in.in:2 +msgid "macOS Frontend" +msgstr "macOS 前端" + +#: macosnotifications/notifications.conf.in.in:2 +msgid "macOS Notification" +msgstr "macOS 通知"