diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe87293..4453e15 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ endif()
project(rpi-imager LANGUAGES CXX)
set(IMAGER_VERSION_MAJOR 1)
-set(IMAGER_VERSION_MINOR 2)
+set(IMAGER_VERSION_MINOR 3)
set(IMAGER_VERSION_STR "${IMAGER_VERSION_MAJOR}.${IMAGER_VERSION_MINOR}")
set(IMAGER_VERSION_CSV "${IMAGER_VERSION_MAJOR},${IMAGER_VERSION_MINOR},0,0")
add_definitions(-DIMAGER_VERSION_STR="${IMAGER_VERSION_STR}")
@@ -62,6 +62,13 @@ set(SOURCES "main.cpp" "imagewriter.cpp" "networkaccessmanagerfactory.cpp"
"drivelistitem.cpp" "drivelistmodel.cpp" "downloadthread.cpp" "downloadextractthread.cpp"
"driveformatthread.cpp" "powersaveblocker.cpp" "qml.qrc")
+find_package(Qt5 COMPONENTS Core Quick Widgets LinguistTools REQUIRED)
+
+#qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} i18n/rpi-imager_nl.ts i18n/rpi-imager_zh_cn.ts)
+qt5_add_translation(QM_FILES i18n/rpi-imager_nl.ts i18n/rpi-imager_zh_cn.ts)
+configure_file(i18n/translations.qrc "${CMAKE_CURRENT_BINARY_DIR}" COPYONLY)
+set(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ${QM_FILES})
+
if (WIN32)
# Adding WIN32 prevents a console window being opened on Windows
add_executable(${PROJECT_NAME} WIN32 ${SOURCES} ${HEADERS} ${DEPENDENCIES})
@@ -69,8 +76,6 @@ else()
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${DEPENDENCIES})
endif()
-find_package(Qt5 COMPONENTS Core Quick Widgets REQUIRED)
-
# Because dependencies are typically not available by default on Windows, build bundled code
if (WIN32)
# Target Windows 7 (needed for drivelist module)
diff --git a/i18n/rpi-imager_nl.ts b/i18n/rpi-imager_nl.ts
new file mode 100644
index 0000000..638cbd9
--- /dev/null
+++ b/i18n/rpi-imager_nl.ts
@@ -0,0 +1,343 @@
+
+
+
+
+ DownloadExtractThread
+
+
+ Error writing to storage
+ Fout bij schrijven naar opslag
+
+
+
+
+ Error extracting archive: %1
+ Fout bij uitpakken archiefbestand: %1
+
+
+
+ Error mounting FAT32 partition
+ Fout bij mounten FAT32 partitie
+
+
+
+ Operating system did not mount FAT32 partition
+ Besturingssysteem heeft FAT32 partitie niet gemount
+
+
+
+ Error changing to directory '%1'
+ Fout bij openen map '%1'
+
+
+
+ DownloadThread
+
+
+ Error running diskpart: %1
+ Fout bij uitvoeren diskpart: %1
+
+
+
+ Error removing existing partitions
+ Fout bij verwijderen bestaande partities
+
+
+
+ Error running authopen to gain access to disk device '%1'
+ Fout bij uitvoeren authopen: '%1'
+
+
+
+ Cannot open storage device '%1'.
+ Fout bij openen opslagapparaat '%1'.
+
+
+
+ Write error while zero'ing out MBR
+ Fout bij wissen MBR
+
+
+
+ Write error while trying to zero out last part of card.
+Card could be advertising wrong capacity (possible counterfeit)
+ Fout bij wissen laatste deel van de SD kaart.
+Kaart geeft mogelijk onjuiste capaciteit aan (mogelijk counterfeit)
+
+
+
+ Error writing to storage (while flushing)
+ Fout bij schrijven naar opslag (tijdens flushen)
+
+
+
+ Error writing to storage (while fsync)
+ Fout bij schrijven naar opslag (tijdens fsync)
+
+
+
+ Download corrupt. Hash does not match
+ Download corrupt. Hash komt niet overeen
+
+
+
+ Error writing first block (partition table)
+ Fout bij schrijven naar eerste deel van kaart (partitie tabel)
+
+
+
+ Error reading from storage.
+SD card may be broken.
+ Fout bij lezen van SD kaart. Kaart is mogelijk defect.
+
+
+
+ Verifying write failed. Contents of SD card is different from what was written to it.
+ Verificatie mislukt. De gegevens die op de SD kaart staan wijken af van wat er naar geschreven is.
+
+
+
+ DriveFormatThread
+
+
+
+
+ Error partitioning: %1
+ Fout bij partitioneren: %1
+
+
+
+ Error starting fat32format
+ Fout bij starten fat32format
+
+
+
+ Error running fat32format: %1
+ Fout bij uitvoeren fat32format: %1
+
+
+
+ Error determining new drive letter
+ Fout bij vaststellen nieuwe letter van schijfstation
+
+
+
+ Invalid device: %1
+ Ongeldig device: %1
+
+
+
+ Error formatting (through udisks2)
+ Fout bij formatteren (via udisks2)
+
+
+
+ Error starting sfdisk
+ Fout bij starten sfdisk
+
+
+
+ Error starting mkfs.fat
+ Fout bij starten mkfs.fat
+
+
+
+ Error running mkfs.fat: %1
+ Fout bij uitvoeren mkfs.fat: %1
+
+
+
+ Formatting not implemented for this platform
+ Formatteren is niet geimplementeerd op dit besturingssysteem
+
+
+
+ ImageWriter
+
+
+ Storage capacity is not large enough.
+Needs to be at least %1 GB
+ Opslagcapaciteit niet groot genoeg.
+Deze dient minimaal %1 GB te zijn
+
+
+
+ Input file is not a valid disk image.
+File size %1 bytes is not a multiple of 512 bytes.
+ Invoerbestand is geen disk image.
+Bestandsgrootte %1 bytes is geen veelvoud van 512 bytes.
+
+
+
+ Downloading and writing image
+ Downloaden en schrijven van image
+
+
+
+ Select image
+ Selecteer image
+
+
+
+ main
+
+
+ Raspberry Pi Imager v%1
+ Raspberry Pi Imager v%1
+
+
+
+
+ Operating System
+ Besturingssysteem
+
+
+
+ CHOOSE OS
+ SELECTEER OS
+
+
+
+
+ SD Card
+ SD kaart
+
+
+
+
+ CHOOSE SD CARD
+ SELECTEER SD KAART
+
+
+
+ WRITE
+ SCHRIJF
+
+
+
+
+ Writing... %1%
+ Schrijven... %1%
+
+
+
+ CANCEL WRITE
+ Annuleer schrijven
+
+
+
+
+ Cancelling...
+ Annuleren...
+
+
+
+ CANCEL VERIFY
+ ANNULEER VERIFICATIE
+
+
+
+
+
+ Finalizing...
+ Afronden...
+
+
+
+
+ Erase
+ Wissen
+
+
+
+ Format card as FAT32
+ Formatteer kaart als FAT32
+
+
+
+ Use custom
+ Gebruik eigen bestand
+
+
+
+ Select a custom .img from your computer
+ Selecteer een eigen .img bestand
+
+
+
+
+ Error parsing os_list.json
+ Fout bij parsen os_list.json
+
+
+
+ Back
+ Terug
+
+
+
+ Go back to main menu
+ Terug naar hoofdmenu
+
+
+
+ Released: %1
+ Release datum: %1
+
+
+
+ Cached on your computer
+ Opgeslagen op computer
+
+
+
+ Online - %1 GB download
+ Online %1 GB download
+
+
+
+ Mounted as %1
+ Mounted op %1
+
+
+
+ QUIT APP
+ AFSLUITEN
+
+
+
+ CONTINUE
+ VERDER GAAN
+
+
+
+ Error downloading OS list from Internet
+ Fout bij downloaden van lijst met besturingssystemen
+
+
+
+ Verifying... %1%
+ Verifiëren... %1%
+
+
+
+ Error
+ Fout
+
+
+
+ Write Successful
+ Klaar met schrijven
+
+
+
+ <b>%2</b> has been erased<br><br>You can now remove the SD card from the reader
+ <b>%2</b> is gewist<br><br>U kunt nu de SD kaart uit de lezer halen
+
+
+
+ <b>%1</b> has been written to <b>%2</b><br><br>You can now remove the SD card from the reader
+ <b>%1</b> is geschreven naar <b>%2</b><br><br>U kunt nu de SD kaart uit de lezer halen
+
+
+
diff --git a/i18n/rpi-imager_zh_cn.ts b/i18n/rpi-imager_zh_cn.ts
new file mode 100644
index 0000000..a7210d5
--- /dev/null
+++ b/i18n/rpi-imager_zh_cn.ts
@@ -0,0 +1,340 @@
+
+
+
+
+ DownloadExtractThread
+
+
+ Error writing to storage
+
+
+
+
+
+ Error extracting archive: %1
+
+
+
+
+ Error mounting FAT32 partition
+
+
+
+
+ Operating system did not mount FAT32 partition
+
+
+
+
+ Error changing to directory '%1'
+
+
+
+
+ DownloadThread
+
+
+ Error running diskpart: %1
+
+
+
+
+ Error removing existing partitions
+
+
+
+
+ Error running authopen to gain access to disk device '%1'
+
+
+
+
+ Cannot open storage device '%1'.
+
+
+
+
+ Write error while zero'ing out MBR
+
+
+
+
+ Write error while trying to zero out last part of card.
+Card could be advertising wrong capacity (possible counterfeit)
+
+
+
+
+ Error writing to storage (while flushing)
+
+
+
+
+ Error writing to storage (while fsync)
+
+
+
+
+ Download corrupt. Hash does not match
+
+
+
+
+ Error writing first block (partition table)
+
+
+
+
+ Error reading from storage.
+SD card may be broken.
+
+
+
+
+ Verifying write failed. Contents of SD card is different from what was written to it.
+
+
+
+
+ DriveFormatThread
+
+
+
+
+ Error partitioning: %1
+
+
+
+
+ Error starting fat32format
+
+
+
+
+ Error running fat32format: %1
+
+
+
+
+ Error determining new drive letter
+
+
+
+
+ Invalid device: %1
+
+
+
+
+ Error formatting (through udisks2)
+
+
+
+
+ Error starting sfdisk
+
+
+
+
+ Error starting mkfs.fat
+
+
+
+
+ Error running mkfs.fat: %1
+
+
+
+
+ Formatting not implemented for this platform
+
+
+
+
+ ImageWriter
+
+
+ Storage capacity is not large enough.
+Needs to be at least %1 GB
+
+
+
+
+ Input file is not a valid disk image.
+File size %1 bytes is not a multiple of 512 bytes.
+
+
+
+
+ Downloading and writing image
+
+
+
+
+ Select image
+
+
+
+
+ main
+
+
+ Raspberry Pi Imager v%1
+ 树莓派镜像烧录 v%1
+
+
+
+
+ Operating System
+ 操作系统
+
+
+
+ CHOOSE OS
+ 选择操作系统
+
+
+
+
+ SD Card
+ SD卡
+
+
+
+
+ CHOOSE SD CARD
+ 选择SD卡
+
+
+
+ WRITE
+ 烧录
+
+
+
+
+ Writing... %1%
+ 写入中...%1%
+
+
+
+ CANCEL WRITE
+ 取消写入
+
+
+
+
+ Cancelling...
+ 取消中...
+
+
+
+ CANCEL VERIFY
+ 取消验证
+
+
+
+
+
+ Finalizing...
+ 完成中...
+
+
+
+
+ Erase
+ 擦除
+
+
+
+ Format card as FAT32
+ 格式化SD卡为FAT32格式
+
+
+
+ Use custom
+ 使用自定义镜像
+
+
+
+ Select a custom .img from your computer
+ 使用下载的系统镜像文件烧录
+
+
+
+
+ Error parsing os_list.json
+ 解析 os_list.json 错误
+
+
+
+ Back
+ 返回
+
+
+
+ Go back to main menu
+ 回到主页
+
+
+
+ Released: %1
+ 解压中...%1
+
+
+
+ Cached on your computer
+ 在你的电脑上缓存
+
+
+
+ Online - %1 GB download
+ 已下载:%1 GB
+
+
+
+ Mounted as %1
+ 挂载在:%1 上
+
+
+
+ QUIT APP
+ 退出
+
+
+
+ CONTINUE
+ 继续
+
+
+
+ Error downloading OS list from Internet
+ 下载镜像列表错误
+
+
+
+ Verifying... %1%
+ 验证文件中...%1%
+
+
+
+ Error
+ 错误
+
+
+
+ Write Successful
+ 烧录成功
+
+
+
+ <b>%2</b> has been erased<br><br>You can now remove the SD card from the reader
+
+
+
+
+ <b>%1</b> has been written to <b>%2</b><br><br>You can now remove the SD card from the reader
+ <b>%1</b> 已经成功烧录到 <b>%2</b><br><br>上了,你可以卸载SD卡了
+
+
+
diff --git a/i18n/translations.qrc b/i18n/translations.qrc
new file mode 100644
index 0000000..550d77d
--- /dev/null
+++ b/i18n/translations.qrc
@@ -0,0 +1,6 @@
+
+
+ rpi-imager_nl.qm
+ rpi-imager_zh_cn.qm
+
+
diff --git a/main.cpp b/main.cpp
index 7f0cfe3..045087f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -16,6 +16,8 @@
#include
#include
#include
+#include
+#include
static QTextStream cerr(stderr);
@@ -40,6 +42,9 @@ int main(int argc, char *argv[])
ImageWriter imageWriter;
NetworkAccessManagerFactory namf;
QQmlApplicationEngine engine;
+ QTranslator translator;
+ if (translator.load(QLocale(), "rpi-imager", "_", QLatin1String(":/i18n")))
+ QCoreApplication::installTranslator(&translator);
/* Parse commandline arguments (if any) */
QString customRepo;