mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 05:49:53 +08:00
refine translations
This commit is contained in:
parent
3b755287e7
commit
a04968913c
@ -28,8 +28,23 @@ set_source_files_properties(${VX_APP_ICON_MACOS} PROPERTIES
|
||||
# Translations
|
||||
set(VX_TS_FILES data/core/translations/vnote_zh_CN.ts
|
||||
data/core/translations/vnote_ja.ts)
|
||||
set_source_files_properties(${VX_TS_FILES} PROPERTIES OUTPUT_LOCATION "data/core/translations")
|
||||
if((QT_DEFAULT_MAJOR_VERSION GREATER 5))
|
||||
qt_add_lupdate(vnote TS_FILES ${VX_TS_FILES})
|
||||
endif()
|
||||
# Generate .qm files from .ts files (lrelease)
|
||||
qt_add_translation(VX_QM_FILES ${VX_TS_FILES})
|
||||
add_custom_target(lrelease DEPENDS ${VX_QM_FILES})
|
||||
|
||||
# TODO: VTextEdit translations
|
||||
list(APPEND VX_QM_FILES
|
||||
data/core/translations/qdialogbuttonbox_zh_CN.qm
|
||||
data/core/translations/qtbase_ja.qm
|
||||
data/core/translations/qtbase_zh_CN.qm
|
||||
data/core/translations/qtv_ja.qm
|
||||
data/core/translations/qtv_zh_CN.qm
|
||||
data/core/translations/qwebengine_zh_CN.qm
|
||||
)
|
||||
install(FILES ${VX_QM_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}/translations" OPTIONAL)
|
||||
|
||||
# Resources
|
||||
set(VX_RESOURCE_FILES data/core/core.qrc)
|
||||
|
@ -2,11 +2,13 @@
|
||||
|
||||
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS Core)
|
||||
|
||||
get_target_property(QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
|
||||
get_target_property(QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
|
||||
get_filename_component(QT_BIN_DIR "${QMAKE_EXECUTABLE}" DIRECTORY)
|
||||
execute_process(COMMAND ${QMAKE_EXECUTABLE} -query QT_VERSION OUTPUT_VARIABLE QT_VERSION)
|
||||
|
||||
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
|
||||
# To use the specific version of Qt
|
||||
set(WINDEPLOYQT_EXECUTABLE "${QT_BIN_DIR}/windeployqt")
|
||||
|
||||
find_program(LINUXDEPLOY_EXECUTABLE linuxdeploy linuxdeploy-x86_64.AppImage HINTS "${QT_BIN_DIR}")
|
||||
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")
|
||||
find_program(MACDEPLOYQTFIX_EXECUTABLE macdeployqtfix.py HINTS "${QT_BIN_DIR}")
|
||||
@ -43,7 +45,9 @@ function(windeployqt target)
|
||||
DEPENDS vnote
|
||||
)
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/winqt/" DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
add_dependencies(deploy lrelease)
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/winqt/" DESTINATION "${CMAKE_INSTALL_BINDIR}" OPTIONAL)
|
||||
set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
|
||||
include(InstallRequiredSystemLibraries)
|
||||
endfunction()
|
||||
|
@ -95,15 +95,5 @@
|
||||
<file>logo/vnote.png</file>
|
||||
<file>logo/256x256/vnote.png</file>
|
||||
<file>logo/vnote_mono.png</file>
|
||||
<file>translations/qdialogbuttonbox_zh_CN.qm</file>
|
||||
<file>translations/qwebengine_zh_CN.qm</file>
|
||||
<file>translations/qt_zh_CN.qm</file>
|
||||
<file>translations/vnote_zh_CN.qm</file>
|
||||
<file>translations/qtbase_zh_CN.qm</file>
|
||||
<file>translations/vtextedit_zh_CN.qm</file>
|
||||
<file>translations/qt_ja.qm</file>
|
||||
<file>translations/vnote_ja.qm</file>
|
||||
<file>translations/qtbase_ja.qm</file>
|
||||
<file>translations/vtextedit_ja.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -1,79 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>QPlatformTheme</name>
|
||||
<message>
|
||||
<source>OK</source>
|
||||
<translation>确定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save</source>
|
||||
<translation>保存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save All</source>
|
||||
<translation>全部保存</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open</source>
|
||||
<translation>打开</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Yes</source>
|
||||
<translation>是(&Y)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Yes to &All</source>
|
||||
<translation>全部选择是(&A)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&No</source>
|
||||
<translation>否(&N)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>N&o to All</source>
|
||||
<translation>全部选择否(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Abort</source>
|
||||
<translation>终止</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Retry</source>
|
||||
<translation>重试</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Ignore</source>
|
||||
<translation>忽略</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close</source>
|
||||
<translation>关闭</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translation>取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Discard</source>
|
||||
<translation>放弃</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Help</source>
|
||||
<translation>帮助</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Apply</source>
|
||||
<translation>应用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reset</source>
|
||||
<translation>重置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restore Defaults</source>
|
||||
<translation>恢复默认</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,193 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<!--QWebEngineView uses different sources for its standard context menu.-->
|
||||
<!--https://code.woboq.org/qt5/qtwebengine/src/core/render_view_context_menu_qt.cpp.html-->
|
||||
<!--https://code.woboq.org/qt5/qtwebengine/src/webenginewidgets/api/qwebenginepage.cpp.html-->
|
||||
<context>
|
||||
<name>RenderViewContextMenuQt</name>
|
||||
<message>
|
||||
<source>Back</source>
|
||||
<translation>后退</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Forward</source>
|
||||
<translation>前进</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reload</source>
|
||||
<translation>重新加载</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cut</source>
|
||||
<translation>剪切</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy</source>
|
||||
<translation>复制</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Paste</source>
|
||||
<translation>粘贴</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Undo</source>
|
||||
<translation>撤消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Redo</source>
|
||||
<translation>恢复</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Select all</source>
|
||||
<translation>选择全部</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Paste and match style</source>
|
||||
<translation>粘贴并匹配样式</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in new window</source>
|
||||
<translation>在新窗口打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in new tab</source>
|
||||
<translation>在新标签页打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy link address</source>
|
||||
<translation>复制链接地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save link</source>
|
||||
<translation>保存链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy image</source>
|
||||
<translation>复制图片</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy image address</source>
|
||||
<translation>复制图片地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save image</source>
|
||||
<translation>保存图片</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Copy media address</source>
|
||||
<translation>复制媒体地址</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Show controls</source>
|
||||
<translation>显示控件</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Loop</source>
|
||||
<translation>循环</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save media</source>
|
||||
<translation>保存媒体</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Inspect</source>
|
||||
<translation>查看</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Exit full screen</source>
|
||||
<translation>退出全屏</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Save page</source>
|
||||
<translation>保存页面</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>View page source</source>
|
||||
<translation>查看页面源码</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QWebEnginePage</name>
|
||||
<message>
|
||||
<source>Stop</source>
|
||||
<translation>停止</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Reload and Bypass Cache</source>
|
||||
<translation>忽略缓存重新加载</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in this window</source>
|
||||
<translation>在当前窗口打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Open link in new background tab</source>
|
||||
<translation>在后台新标签页打开链接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Toggle Play/Pause</source>
|
||||
<translation>切换播放/暂停</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Toggle Mute</source>
|
||||
<translation>切换静音</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Close Page</source>
|
||||
<translation>关闭页面</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Unselect</source>
|
||||
<translation>取消选择</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Bold</source>
|
||||
<translation>粗体(&B)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Italic</source>
|
||||
<translation>斜体(&I)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Underline</source>
|
||||
<translation>下划线(&U)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Strikethrough</source>
|
||||
<translation>删除线(&S)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Left</source>
|
||||
<translation>左对齐(&L)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Center</source>
|
||||
<translation>居中对齐(&C)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Right</source>
|
||||
<translation>右对齐(&R)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Align &Justified</source>
|
||||
<translation>两端对齐(&J)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Indent</source>
|
||||
<translation>缩进(&I)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>&Outdent</source>
|
||||
<translation>减小缩进(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insert &Ordered List</source>
|
||||
<translation>插入有序列表(&O)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insert &Unordered List</source>
|
||||
<translation>插入无序列表(&U)</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17
src/main.cpp
17
src/main.cpp
@ -204,47 +204,42 @@ void loadTranslators(QApplication &p_app)
|
||||
QLocale locale;
|
||||
qInfo() << "locale:" << locale.name();
|
||||
|
||||
const QString resourceTranslationFolder(QStringLiteral(":/vnotex/data/core/translations"));
|
||||
const QString envTranslationFolder(QStringLiteral("translations"));
|
||||
|
||||
// For QTextEdit/QTextBrowser and other basic widgets.
|
||||
QScopedPointer<QTranslator> qtbaseTranslator(new QTranslator(&p_app));
|
||||
if (qtbaseTranslator->load(locale, "qtbase", "_", resourceTranslationFolder)) {
|
||||
if (qtbaseTranslator->load(locale, "qtbase", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(qtbaseTranslator.take());
|
||||
}
|
||||
|
||||
// qt_zh_CN.ts does not cover the real QDialogButtonBox which uses QPlatformTheme.
|
||||
QScopedPointer<QTranslator> dialogButtonBoxTranslator(new QTranslator(&p_app));
|
||||
if (dialogButtonBoxTranslator->load(locale, "qdialogbuttonbox", "_", resourceTranslationFolder)) {
|
||||
if (dialogButtonBoxTranslator->load(locale, "qdialogbuttonbox", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(dialogButtonBoxTranslator.take());
|
||||
}
|
||||
|
||||
QScopedPointer<QTranslator> webengineTranslator(new QTranslator(&p_app));
|
||||
if (webengineTranslator->load(locale, "qwebengine", "_", resourceTranslationFolder)) {
|
||||
if (webengineTranslator->load(locale, "qwebengine", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(webengineTranslator.take());
|
||||
}
|
||||
|
||||
// Load translation for Qt from resource.
|
||||
QScopedPointer<QTranslator> qtTranslator(new QTranslator(&p_app));
|
||||
if (qtTranslator->load(locale, "qt", "_", resourceTranslationFolder)) {
|
||||
if (qtTranslator->load(locale, "qtv", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(qtTranslator.take());
|
||||
}
|
||||
|
||||
// Load translation for Qt from env.
|
||||
QScopedPointer<QTranslator> qtEnvTranslator(new QTranslator(&p_app));
|
||||
if (qtEnvTranslator->load(locale, "qt", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(qtEnvTranslator.take());
|
||||
}
|
||||
|
||||
// Load translation for vnote from resource.
|
||||
QScopedPointer<QTranslator> vnoteTranslator(new QTranslator(&p_app));
|
||||
if (vnoteTranslator->load(locale, "vnote", "_", resourceTranslationFolder)) {
|
||||
if (vnoteTranslator->load(locale, "vnote", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(vnoteTranslator.take());
|
||||
}
|
||||
|
||||
// Load translation for vtextedit from resource.
|
||||
QScopedPointer<QTranslator> vtexteditTranslator(new QTranslator(&p_app));
|
||||
if (vtexteditTranslator->load(locale, "vtextedit", "_", resourceTranslationFolder)) {
|
||||
if (vtexteditTranslator->load(locale, "vtextedit", "_", envTranslationFolder)) {
|
||||
p_app.installTranslator(vtexteditTranslator.take());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user