Skip to content

Commit

Permalink
chore: load translations in dde-control-center
Browse files Browse the repository at this point in the history
load translations in dde-control-center
  • Loading branch information
zsien committed Apr 26, 2023
1 parent c6ecea7 commit 9343e83
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
cmake_minimum_required(VERSION 3.7)
project(deepin-fcitx5configtool-plugin VERSION 5.0.5)

include(GNUInstallDirs)

set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(DEFAULT_XKB_RULES "evdev" CACHE STRING "Xkb rules name")
Expand All @@ -22,4 +23,4 @@ execute_process(COMMAND bash translate_generation.sh

## qm files
file(GLOB QM_FILES "translations/*.qm")
install(FILES ${QM_FILES} DESTINATION share/deepin-fcitx5configtool-plugin/translations)
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/dde-control-center/translations)
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ endif ()
# 设置执行 make install 时哪个目标应该被 install 到哪个位置

if(NOT ${CMAKE_BUILD_TYPE} MATCHES "Debug")
install(TARGETS ${BIN_NAME} LIBRARY DESTINATION /lib/dde-control-center/modules)
install(TARGETS ${BIN_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/dde-control-center/modules)
endif()

add_subdirectory(layout)
Expand Down
5 changes: 1 addition & 4 deletions src/fcitx5configplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@

Fcitx5ConfigPlugin::Fcitx5ConfigPlugin()
{
QTranslator *translator = new QTranslator(this);
translator->load(QString("/usr/share/deepin-fcitx5configtool-plugin/translations/deepin-fcitx5configtool-plugin_%1.qm").arg(QLocale().name()));
QCoreApplication::installTranslator(translator); //安装翻译器
}

QString Fcitx5ConfigPlugin::name() const
{
return tr("Input Methods");
return tr("deepin-fcitx5configtool-plugin");
}

QString Fcitx5ConfigPlugin::follow() const
Expand Down
30 changes: 17 additions & 13 deletions translations/deepin-fcitx5configtool-plugin_en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,49 @@
<context>
<name>Fcitx5ConfigPlugin</name>
<message>
<location filename="../src/fcitx5configplugin.cpp" line="28"/>
<source>Input Methods</source>
<translation>Input Methods</translation>
<translation type="vanished">Input Methods</translation>
</message>
<message>
<location filename="../src/fcitx5configplugin.cpp" line="43"/>
<location filename="../src/fcitx5configplugin.cpp" line="25"/>
<source>deepin-fcitx5configtool-plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/fcitx5configplugin.cpp" line="40"/>
<source>Input Method</source>
<translation>Input Method</translation>
</message>
</context>
<context>
<name>IMSettingWindow</name>
<message>
<location filename="../src/window/imsettingwindow.cpp" line="179"/>
<location filename="../src/window/imsettingwindow.cpp" line="178"/>
<source>Scroll between input methods</source>
<translation>Scroll between input methods</translation>
</message>
<message>
<location filename="../src/window/imsettingwindow.cpp" line="182"/>
<location filename="../src/window/imsettingwindow.cpp" line="181"/>
<source>Switch between the current/first input method</source>
<translation>Switch between the current/first input method</translation>
</message>
<message>
<location filename="../src/window/imsettingwindow.cpp" line="72"/>
<location filename="../src/window/imsettingwindow.cpp" line="117"/>
<source>Manage Input Methods</source>
<translation>Manage Input Methods</translation>
</message>
<message>
<location filename="../src/window/imsettingwindow.cpp" line="166"/>
<location filename="../src/window/imsettingwindow.cpp" line="165"/>
<source>Shortcuts</source>
<translation>Shortcuts</translation>
</message>
<message>
<location filename="../src/window/imsettingwindow.cpp" line="171"/>
<location filename="../src/window/imsettingwindow.cpp" line="170"/>
<source>Restore Defaults</source>
<translation>Restore Defaults</translation>
</message>
<message>
<location filename="../src/window/imsettingwindow.cpp" line="197"/>
<location filename="../src/window/imsettingwindow.cpp" line="196"/>
<source>Advanced Settings</source>
<translation>Advanced Settings</translation>
</message>
Expand Down Expand Up @@ -84,22 +88,22 @@
<context>
<name>fcitx::addim::IMPage</name>
<message>
<location filename="../src/addim/widgetslib/impage.cpp" line="78"/>
<location filename="../src/addim/widgetslib/impage.cpp" line="94"/>
<source>Select your language and add input methods</source>
<translation type="unfinished">Select your language and add input methods</translation>
</message>
<message>
<location filename="../src/addim/widgetslib/impage.cpp" line="139"/>
<location filename="../src/addim/widgetslib/impage.cpp" line="157"/>
<source>Find more in App Store</source>
<translation>Find more in App Store</translation>
</message>
<message>
<location filename="../src/addim/widgetslib/impage.cpp" line="150"/>
<location filename="../src/addim/widgetslib/impage.cpp" line="168"/>
<source>Cancel</source>
<translation>Cancel</translation>
</message>
<message>
<location filename="../src/addim/widgetslib/impage.cpp" line="153"/>
<location filename="../src/addim/widgetslib/impage.cpp" line="171"/>
<source>Add</source>
<translation type="unfinished"></translation>
</message>
Expand Down

0 comments on commit 9343e83

Please sign in to comment.