diff --git a/.gitignore b/.gitignore
index 8a42ecd..27f5ccd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -61,3 +61,6 @@ CMakeLists.txt.user*
git_tag.inc
git_tag.ci.inc
.DS_Store
+lang/yuvviewer_en_US.qm
+lang/yuvviewer_ja_JP.qm
+lang/yuvviewer_zh_CN.qm
diff --git a/YUVviewer.pro b/YUVviewer.pro
index 6894642..856b9a3 100644
--- a/YUVviewer.pro
+++ b/YUVviewer.pro
@@ -47,6 +47,11 @@ FORMS += \
RESOURCES += \
src/img.qrc
+TRANSLATIONS += \
+ lang/yuvviewer_zh_CN.ts \
+ lang/yuvviewer_ja_JP.ts \
+ lang/yuvviewer_en_US.ts
+
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
diff --git a/build_deb.sh b/build_deb.sh
index e919898..0847a16 100755
--- a/build_deb.sh
+++ b/build_deb.sh
@@ -22,6 +22,7 @@ export QML2_IMPORT_PATH=$QT_DIR/qml
YUVVIEWER_VERSION="V"$YUVVIEWER_MAJARVERSION$YUVVIEWER_SUBVERSION$YUVVIEWER_REVISION
# 编译
rm -rf .qmake.stash Makefile
+lrelease ./YUVviewer.pro
qmake ./YUVviewer.pro -spec linux-g++ CONFIG+=qtquickcompiler
make clean
make -j8
diff --git a/build_dmg.sh b/build_dmg.sh
index fd49e75..3445d7a 100755
--- a/build_dmg.sh
+++ b/build_dmg.sh
@@ -22,6 +22,7 @@ export QML2_IMPORT_PATH=$QT_DIR/qml
YUVVIEWER_VERSION="V"$YUVVIEWER_MAJARVERSION$YUVVIEWER_SUBVERSION$YUVVIEWER_REVISION
# 编译
rm -rf .qmake.stash Makefile
+$QT_DIR/bin/lrelease ./YUVviewer.pro
$QT_DIR/bin/qmake -makefile
make
cp -R ./test ./build_release/out/YUVviewer.app/Contents/Resources/test
diff --git a/build_setup.bat b/build_setup.bat
index b73fe31..27419c0 100644
--- a/build_setup.bat
+++ b/build_setup.bat
@@ -24,6 +24,7 @@ if exist ".\build_debug" (
if exist ".\build_release" (
rmdir /Q /S .\build_release
)
+lrelease YUVviewer.pro
qmake YUVviewer.pro -spec win32-g++
mingw32-make -j8
:: clean打包目录
diff --git a/lang/yuvviewer_en_US.ts b/lang/yuvviewer_en_US.ts
new file mode 100644
index 0000000..50db155
--- /dev/null
+++ b/lang/yuvviewer_en_US.ts
@@ -0,0 +1,117 @@
+
+
+
+
+ ImgExportWindow
+
+
+
+
+
+
+
+
+
+
+
+
+ ImgViewerWindow
+
+
+
+
+
+
+
+ YUVviewer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lang/yuvviewer_ja_JP.ts b/lang/yuvviewer_ja_JP.ts
new file mode 100644
index 0000000..df3f5ce
--- /dev/null
+++ b/lang/yuvviewer_ja_JP.ts
@@ -0,0 +1,125 @@
+
+
+
+
+ ImgExportWindow
+
+
+
+ 形式
+
+
+
+
+ ファイル形式
+
+
+
+ ImgViewerWindow
+
+
+
+ <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">ファイルを読み込んでいます。お待ちください...</span></p></body></html>
+
+
+
+ YUVviewer
+
+
+
+ フレームサイズ
+
+
+
+
+ 他の
+
+
+
+
+ YUV形式
+
+
+
+
+ <html><head/><body><p align="center">幅</p></body></html>
+
+
+
+
+ <html><head/><body><p align="center">高い</p></body></html>
+
+
+
+
+ プレイパラメータ
+
+
+
+
+ フレームレート
+
+
+
+
+ から
+
+
+
+
+ まで
+
+
+
+
+ ファイルを開く
+
+
+
+
+ 開いたフォルダ
+
+
+
+
+ ヘルプ
+
+
+
+
+
+ について
+
+
+
+
+ Qtについて
+
+
+
+
+ 1.メインインターフェイスでパラメータを選択します。
+2.「ファイルまたはフォルダーを開く」をクリックして画像データを解析し、画像を表示します。
+3.画像表示インターフェースで使用
+ - スクロール ホイールを使用して画像を拡大または縮小します。
+ - 左ボタンを使用して画像をドラッグします。
+ - 左ボタンをダブルクリックして、画像を png 形式またはその他の raw 形式でエクスポートします。
+ - 右クリックして画像のサイズと位置をリセットします。
+ - 右ボタンをダブルクリックして画像の R チャンネルと B チャンネルの表示を切り替えます。
+ - 中クリックすると、画像の元のサイズが表示されます。
+
+
+
+
+ <p>バージョン</p><p> %1</p><p>コミット</p><p> %2</p><p>開発者</p><p> qiaoqm@aliyun.com</p><p>ウェブサイト</p><p> <a href='https://github.com/QQxiaoming/YUVviewer'>https://github.com/QQxiaoming</p><p> <a href='https://gitee.com/QQxiaoming/YUVviewer'>https://gitee.com/QQxiaoming</a></p>
+
+
+
diff --git a/lang/yuvviewer_zh_CN.ts b/lang/yuvviewer_zh_CN.ts
new file mode 100644
index 0000000..3fb4dce
--- /dev/null
+++ b/lang/yuvviewer_zh_CN.ts
@@ -0,0 +1,125 @@
+
+
+
+
+ ImgExportWindow
+
+
+
+ 格式
+
+
+
+
+ 文件格式
+
+
+
+ ImgViewerWindow
+
+
+
+ <html><head/><body><p><span style=" font-size:24pt; font-weight:600;">正在加载文件,请稍候......</span></p></body></html>
+
+
+
+ YUVviewer
+
+
+
+ 帧大小
+
+
+
+
+ 其他
+
+
+
+
+ YUV格式
+
+
+
+
+ <html><head/><body><p align="center">宽度</p></body></html>
+
+
+
+
+ <html><head/><body><p align="center">高度</p></body></html>
+
+
+
+
+ 播放参数
+
+
+
+
+ 帧率
+
+
+
+
+ 从
+
+
+
+
+ 到
+
+
+
+
+ 打开文件
+
+
+
+
+ 打开文件夹
+
+
+
+
+ 帮助
+
+
+
+
+
+ 关于
+
+
+
+
+ 关于Qt
+
+
+
+
+ 1.在主界面选择参数。
+2.单击“打开文件或文件夹”以解析图像数据并显示图像。
+3.用于图像显示界面
+ - 滚轮可放大和缩小图像,
+ - 使用左键拖动图像,
+ - 双击左键将图像导出为png格式或其他raw格式,
+ - 右键单击可重置图像大小和位置,
+ - 双击右键可交换图像R、B通道显示,
+ - 单击鼠标中键可显示图像的原始尺寸。
+
+
+
+
+ <p>版本</p><p> %1</p><p>提交</p><p> %2</p><p>作者</p><p> qiaoqm@aliyun.com</p><p>主页</p><p> <a href='https://github.com/QQxiaoming/YUVviewer'>https://github.com/QQxiaoming</p><p> <a href='https://gitee.com/QQxiaoming/YUVviewer'>https://gitee.com/QQxiaoming</a></p>
+
+
+
diff --git a/src/UI_ImgExport.ui b/src/UI_ImgExport.ui
index cbc850a..bfb0754 100644
--- a/src/UI_ImgExport.ui
+++ b/src/UI_ImgExport.ui
@@ -25,7 +25,7 @@
-
- png
+ png
@@ -35,7 +35,7 @@
true
- YV12
+ YV12
@@ -45,7 +45,7 @@
true
- YU12/I420
+ YU12/I420
@@ -55,7 +55,7 @@
true
- NV21
+ NV21
@@ -65,7 +65,7 @@
true
- NV12
+ NV12
@@ -75,7 +75,7 @@
true
- YUY2/YUYV
+ YUY2/YUYV
@@ -85,7 +85,7 @@
true
- YVYU
+ YVYU
@@ -95,7 +95,7 @@
true
- UYVY
+ UYVY
@@ -105,7 +105,7 @@
true
- 4:4:4
+ 4:4:4
@@ -115,7 +115,7 @@
true
- RGB565_L
+ RGB565_L
@@ -129,7 +129,7 @@
true
- RGB565_B
+ RGB565_B
@@ -139,7 +139,7 @@
true
- BGR565_L
+ BGR565_L
@@ -149,7 +149,7 @@
true
- BGR565_B
+ BGR565_B
@@ -159,7 +159,7 @@
true
- RGB888
+ RGB888
@@ -169,7 +169,7 @@
true
- BayerBG
+ BayerBG
@@ -179,7 +179,7 @@
true
- BayerGB
+ BayerGB
@@ -189,7 +189,7 @@
true
- BayerRG
+ BayerRG
@@ -199,7 +199,7 @@
true
- BayerGR
+ BayerGR
@@ -209,7 +209,7 @@
true
- BayerBG_RAW10
+ BayerBG_RAW10
@@ -219,7 +219,7 @@
true
- BayerGB_RAW10
+ BayerGB_RAW10
@@ -233,7 +233,7 @@
true
- BayerRG_RAW10
+ BayerRG_RAW10
@@ -243,35 +243,35 @@
true
- BayerGR_RAW10
+ BayerGR_RAW10
-
- BayerBG_RAW12
+ BayerBG_RAW12
-
- BayerGB_RAW12
+ BayerGB_RAW12
-
- BayerRG_RAW12
+ BayerRG_RAW12
-
- BayerGR_RAW12
+ BayerGR_RAW12
@@ -281,7 +281,7 @@
true
- BayerBG_RAW16
+ BayerBG_RAW16
@@ -291,7 +291,7 @@
true
- BayerGB_RAW16
+ BayerGB_RAW16
@@ -301,7 +301,7 @@
true
- BayerRG_RAW16
+ BayerRG_RAW16
@@ -311,7 +311,7 @@
true
- BayerGR_RAW16
+ BayerGR_RAW16
diff --git a/src/UI_ImgViewer.ui b/src/UI_ImgViewer.ui
index eba0b8d..59efe9e 100644
--- a/src/UI_ImgViewer.ui
+++ b/src/UI_ImgViewer.ui
@@ -11,7 +11,7 @@
- Form
+
-
diff --git a/src/UI_YUVviewer.ui b/src/UI_YUVviewer.ui
index 3be4d8e..66a3d91 100644
--- a/src/UI_YUVviewer.ui
+++ b/src/UI_YUVviewer.ui
@@ -29,7 +29,7 @@
- YUVviewer
+ YUVviewer
@@ -86,152 +86,152 @@
-
- YV12
+ YV12
-
- YU12/I420
+ YU12/I420
-
- NV21
+ NV21
-
- NV12
+ NV12
-
- YUY2/YUYV
+ YUY2/YUYV
-
- YVYU
+ YVYU
-
- UYVY
+ UYVY
-
- 4:4:4
+ 4:4:4
-
- RGB565_L
+ RGB565_L
-
- RGB565_B
+ RGB565_B
-
- BGR565_L
+ BGR565_L
-
- BGR565_B
+ BGR565_B
-
- RGB888
+ RGB888
-
- BayerBG
+ BayerBG
-
- BayerGB
+ BayerGB
-
- BayerRG
+ BayerRG
-
- BayerGR
+ BayerGR
-
- BayerBG_RAW10
+ BayerBG_RAW10
-
- BayerGB_RAW10
+ BayerGB_RAW10
-
- BayerRG_RAW10
+ BayerRG_RAW10
-
- BayerGR_RAW10
+ BayerGR_RAW10
-
- BayerBG_RAW12
+ BayerBG_RAW12
-
- BayerGB_RAW12
+ BayerGB_RAW12
-
- BayerRG_RAW12
+ BayerRG_RAW12
-
- BayerGR_RAW12
+ BayerGR_RAW12
-
- BayerBG_RAW16
+ BayerBG_RAW16
-
- BayerGB_RAW16
+ BayerGB_RAW16
-
- BayerRG_RAW16
+ BayerRG_RAW16
-
- BayerGR_RAW16
+ BayerGR_RAW16
-
- PNG
+ PNG
@@ -330,7 +330,7 @@
- ↔
+ ↔
@@ -378,17 +378,17 @@
-
- 30
+ 30
-
- 60
+ 60
-
- 120
+ 120
diff --git a/src/YUVviewer.cpp b/src/YUVviewer.cpp
index 237dc56..c7d5caa 100644
--- a/src/YUVviewer.cpp
+++ b/src/YUVviewer.cpp
@@ -14,6 +14,8 @@
#include
#include
#include
+#include
+#include
#include "YUVviewer.h"
#include "ui_UI_YUVviewer.h"
@@ -727,10 +729,16 @@ void YUVviewer::openFolder() {
}
void YUVviewer::help() {
- QMessageBox::question(this, "Help",
- "1.主界面选择数据参数。\n2.点击打开文件或文件夹将进行图像数据解析并显示图像。\n"
- "3.图像显示界面中使用滚轮放大缩小图像,使用左键可拖动图像,双击左键保存图像为png格式,"
- "单击右键复位图像大小和位置,双击右键交换图像R和B通道显示,单击中键显示图像原始大小。",
+ QMessageBox::question(this, "Help", tr(
+ "1.Select parameters on the main interface.\n"
+ "2.Click Open File or Folder to parse the image data and display the image.\n"
+ "3.Used in the image display interface\n"
+ " - scroll wheel to zoom in and out of the image,\n"
+ " - use the left button to drag the image,\n"
+ " - Double click the left button to export the image as png format or other raw format,\n"
+ " - Right click to reset image size and position,\n"
+ " - Double click on the right button to swap the image R and B channel display,\n"
+ " - Middle click to display the original size of the image."),
QMessageBox::StandardButtons(QMessageBox::Ok));
}
@@ -764,6 +772,10 @@ void YUVviewer::closeEvent(QCloseEvent *event) {
event->accept();
}
+static QTranslator qtTranslator;
+static QTranslator qtbaseTranslator;
+static QTranslator appTranslator;
+
int main(int argc, char *argv[]) {
if(argc == 2) {
if((!strncmp(argv[1],"--version",9)) | (!strncmp(argv[1],"-v",2)) ) {
@@ -779,6 +791,42 @@ int main(int argc, char *argv[]) {
font.setFamily(font.defaultFamily());
font.setPixelSize(13);
application.setFont(font);
+
+ QLocale locale;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ QString qlibpath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
+#else
+ QString qlibpath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+#endif
+ QLocale::Language lang = locale.language();
+ switch(lang) {
+ case QLocale::Chinese:
+ if(qtTranslator.load("qt_zh_CN.qm",qlibpath))
+ application.installTranslator(&qtTranslator);
+ if(qtbaseTranslator.load("qtbase_zh_CN.qm",qlibpath))
+ application.installTranslator(&qtbaseTranslator);
+ if(appTranslator.load(":/lang/lang/yuvviewer_zh_CN.qm"))
+ application.installTranslator(&appTranslator);
+ break;
+ case QLocale::Japanese:
+ if(qtTranslator.load("qt_ja.qm",qlibpath))
+ application.installTranslator(&qtTranslator);
+ if(qtbaseTranslator.load("qtbase_ja.qm",qlibpath))
+ application.installTranslator(&qtbaseTranslator);
+ if(appTranslator.load(":/lang/lang/yuvviewer_ja_JP.qm"))
+ application.installTranslator(&appTranslator);
+ break;
+ default:
+ case QLocale::English:
+ if(qtTranslator.load("qt_en.qm",qlibpath))
+ application.installTranslator(&qtTranslator);
+ if(qtbaseTranslator.load("qtbase_en.qm",qlibpath))
+ application.installTranslator(&qtbaseTranslator);
+ if(appTranslator.load(":/lang/lang/yuvviewer_en_US.qm"))
+ application.installTranslator(&appTranslator);
+ break;
+ }
+
YUVviewer window;
window.show();
diff --git a/src/img.qrc b/src/img.qrc
index a1f8464..bec315c 100644
--- a/src/img.qrc
+++ b/src/img.qrc
@@ -4,4 +4,9 @@
../img/right.png
../img/ico.png
+
+ ../lang/yuvviewer_zh_CN.qm
+ ../lang/yuvviewer_ja_JP.qm
+ ../lang/yuvviewer_en_US.qm
+