diff --git a/.github/workflows/cmake-freebsd-amd64.yml b/.github/workflows/cmake-freebsd-amd64.yml index 2c91642..54f1879 100644 --- a/.github/workflows/cmake-freebsd-amd64.yml +++ b/.github/workflows/cmake-freebsd-amd64.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - os-version: ['13.2', '14.1'] + os-version: ['14.1'] # Don't abort runners if a single one fails fail-fast: false steps: diff --git a/.github/workflows/cmake-linux-amd64-appimage.yml b/.github/workflows/cmake-linux-amd64-appimage.yml index d7b2b14..060afe9 100644 --- a/.github/workflows/cmake-linux-amd64-appimage.yml +++ b/.github/workflows/cmake-linux-amd64-appimage.yml @@ -21,10 +21,10 @@ jobs: include: - os: ubuntu-20.04 qt-ver: 5 - qt-pkg: qtbase5-dev + qt-pkg: qtbase5-dev qttools5-dev - os: ubuntu-24.04 qt-ver: 6 - qt-pkg: qt6-base-dev + qt-pkg: qt6-base-dev qt6-tools-dev runs-on: ${{matrix.os}} steps: @@ -38,7 +38,7 @@ jobs: - name: Install libefivar, libefiboot and their dev files run: | sudo apt update -y - sudo apt install -y libefivar-dev libefiboot-dev ${{matrix.qt-pkg}} fuse + sudo apt install -y ${{matrix.qt-pkg}} fuse - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d30270..398cbae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Network REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Network LinguistTools REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Network REQUIRED) set(PROJECT_SOURCES @@ -46,18 +46,39 @@ set(PROJECT_SOURCES qefivar/qefidpmessage.cpp ) +# Add translations files here +set(TRANSLATIONS + translations/app_en.ts + translations/app_fr.ts + translations/app_zh.ts +) +set_source_files_properties( + ${TRANSLATIONS} PROPERTIES + # Set OUTPUT_LOCATION to the directory where the .qm files should be generated in Qt5 + OUTPUT_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/translations + # Set TARGET_DIRECTORY to the directory where the .qm files should be generated in Qt6 + TARGET_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/translations +) + if(WIN32) list(PREPEND PROJECT_SOURCES WIN32) set(CMAKE_EXE_LINKER_FLAGS "/MANIFESTUAC:\"level='requireAdministrator'\"") endif() +# TODO: Set the linguist tools to optional if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) - qt_add_executable(QEFIEntryManager + find_package(Qt6LinguistTools REQUIRED) + qt_create_translation(QM_FILES ${TRANSLATIONS} ${CMAKE_CURRENT_SOURCE_DIR}) + add_executable(QEFIEntryManager ${PROJECT_SOURCES} + translations/translations.qrc ) else() + find_package(Qt5LinguistTools REQUIRED) + qt5_create_translation(QM_FILES ${TRANSLATIONS} ${CMAKE_CURRENT_SOURCE_DIR}) add_executable(QEFIEntryManager ${PROJECT_SOURCES} + translations/translations.qrc ) endif() diff --git a/main.cpp b/main.cpp index dd26075..5ad1cb6 100644 --- a/main.cpp +++ b/main.cpp @@ -1,7 +1,10 @@ #include "mainwindow.h" #include +#include #include +#include +#include #include #include @@ -11,7 +14,18 @@ int main(int argc, char *argv[]) a.setDesktopFileName("qefientrymanager"); a.setWindowIcon(QIcon("../cc.inoki.qefientrymanager.png")); - if (!qefi_is_available() || !qefi_has_privilege()) { + QTranslator translator; + if (translator.load(QLocale(), QStringLiteral("app"), QStringLiteral("_"), QStringLiteral(":/translations"), QStringLiteral(".qm"))) + { + a.installTranslator(&translator); + } + else + { + qDebug() << "Failed to load translation"; + } + + if (!qefi_is_available() || !qefi_has_privilege()) + { QMessageBox::critical(nullptr, QObject::tr("Error"), QObject::tr("Permission insufficient or no EFI environment")); return 1; diff --git a/translations/app_en.ts b/translations/app_en.ts new file mode 100644 index 0000000..11ca0d1 --- /dev/null +++ b/translations/app_en.ts @@ -0,0 +1,318 @@ + + + + + BootEntryEditorDialog + + + Add EFI Boot Entry + Add EFI Boot Entry + + + + EditorDialog + + + Add Device Path + Add Device Path + + + + MainWindow + + + EFI Entry Manager + EFI Entry Manager + + + + QEFIDPEditorView + + + Partition Num + Partition Num + + + + Start + Start + + + + Size + Size + + + + Format + Format + + + + Signature Type + Signature Type + + + + Signature + Signature + + + + File + File + + + + GPT + GPT + + + + PCAT + PCAT + + + + None + None + + + + MBR + MBR + + + + GUID + GUID + + + + QEFIEntryDetailBriefView + + + Device Path instance: + Device Path instance: + + + + Device Path %1 type: + Device Path %1 type: + + + + QEFIEntryDetailView + + + Brief + Brief + + + + QEFIEntryView + + + Move up + Move up + + + + Move down + Move down + + + + Make default + Make default + + + + Set reboot + Set reboot + + + + Timeout: %1 second(s) + Timeout: %1 second(s) + + + + + + Add + Add + + + + + + Import + Import + + + + Save + Save + + + + Reset + Reset + + + + Reboot to + Reboot to + + + + Do you want to reboot now? + Do you want to reboot now? + + + + Export failed + Export failed + + + + Data to export is empty. + Data to export is empty. + + + + Export Boot%1 + Export Boot%1 + + + + Disable + Disable + + + + Enable + Enable + + + + Delete + Delete + + + + Export + Export + + + + Property + Property + + + + + + + + Import failed + Import failed + + + + + Data are invalidated. + Data are invalidated. + + + + Choose an ID + Choose an ID + + + + Hex value from 0 to FFFF + Hex value from 0 to FFFF + + + + + + The action is cancelled. + The action is cancelled. + + + + The chosen ID is invalidated. + The chosen ID is invalidated. + + + + + Do you want to override Boot%1? + Do you want to override Boot%1? + + + + + + Data might be invalidated. + Data might be invalidated. + + + + + + + Add failed + Add failed + + + + QEFILoadOptionEditorView + + + ID: + ID: + + + + Name: + Name: + + + + Optional Data: + Optional Data: + + + + Add Device Path + Add Device Path + + + + Clear Device Path + Clear Device Path + + + + Device Path: + Device Path: + + + + QObject + + + Error + Error + + + + Permission insufficient or no EFI environment + Permission insufficient or no EFI environment + + + diff --git a/translations/app_fr.ts b/translations/app_fr.ts new file mode 100644 index 0000000..7c5e413 --- /dev/null +++ b/translations/app_fr.ts @@ -0,0 +1,318 @@ + + + + + BootEntryEditorDialog + + + Add EFI Boot Entry + Ajouter une entrée de démarrage EFI + + + + EditorDialog + + + Add Device Path + Ajouter un chemin de périphérique + + + + MainWindow + + + EFI Entry Manager + Gestionnaire d'entrée EFI + + + + QEFIDPEditorView + + + Partition Num + Numéro de partition + + + + Start + Début + + + + Size + Taille + + + + Format + Format + + + + Signature Type + Type de signature + + + + Signature + Signature + + + + File + Fichier + + + + GPT + GPT + + + + PCAT + PCAT + + + + None + Aucun + + + + MBR + MBR + + + + GUID + GUID + + + + QEFIEntryDetailBriefView + + + Device Path instance: + Instance de chemin de périphérique : + + + + Device Path %1 type: + Type de chemin de périphérique %1 : + + + + QEFIEntryDetailView + + + Brief + Résumé + + + + QEFIEntryView + + + Move up + Déplacer vers le haut + + + + Move down + Déplacer vers le bas + + + + Make default + Définir par défaut + + + + Set reboot + Définir le redémarrage + + + + Timeout: %1 second(s) + Délai d'attente : %1 seconde(s) + + + + + + Add + Ajouter + + + + + + Import + Importer + + + + Save + Enregistrer + + + + Reset + Réinitialiser + + + + Reboot to + Redémarrer vers + + + + Do you want to reboot now? + Voulez-vous redémarrer maintenant ? + + + + Export failed + Échec de l'exportation + + + + Data to export is empty. + Les données à exporter sont vides. + + + + Export Boot%1 + Exporter Boot%1 + + + + Disable + Désactiver + + + + Enable + Activer + + + + Delete + Supprimer + + + + Export + Exporter + + + + Property + Propriété + + + + + + + + Import failed + Échec de l'importation + + + + + Data are invalidated. + Les données sont invalidées. + + + + Choose an ID + Choisissez un ID + + + + Hex value from 0 to FFFF + Valeur hexadécimale de 0 à FFFF + + + + + + The action is cancelled. + L'action est annulée. + + + + The chosen ID is invalidated. + L'ID choisi est invalidé. + + + + + Do you want to override Boot%1? + Voulez-vous remplacer Boot%1 ? + + + + + + Data might be invalidated. + Les données pourraient être invalidées. + + + + + + + Add failed + Échec de l'ajout + + + + QEFILoadOptionEditorView + + + ID: + ID : + + + + Name: + Nom : + + + + Optional Data: + Données optionnelles : + + + + Add Device Path + Ajouter un chemin de périphérique + + + + Clear Device Path + Effacer le chemin de périphérique + + + + Device Path: + Chemin de périphérique : + + + + QObject + + + Error + Erreur + + + + Permission insufficient or no EFI environment + Permission insuffisante ou pas d'environnement EFI + + + diff --git a/translations/app_zh.ts b/translations/app_zh.ts new file mode 100644 index 0000000..2bd48f9 --- /dev/null +++ b/translations/app_zh.ts @@ -0,0 +1,318 @@ + + + + + BootEntryEditorDialog + + + Add EFI Boot Entry + 添加 EFI 启动项 + + + + EditorDialog + + + Add Device Path + 添加设备路径 + + + + MainWindow + + + EFI Entry Manager + EFI 启动项管理器 + + + + QEFIDPEditorView + + + Partition Num + 分区号 + + + + Start + 开始 + + + + Size + 大小 + + + + Format + 格式 + + + + Signature Type + 签名类型 + + + + Signature + 签名 + + + + File + 文件 + + + + GPT + GPT + + + + PCAT + PCAT + + + + None + + + + + MBR + MBR + + + + GUID + GUID + + + + QEFIEntryDetailBriefView + + + Device Path instance: + 设备路径实例: + + + + Device Path %1 type: + 设备路径 %1 类型: + + + + QEFIEntryDetailView + + + Brief + 概要 + + + + QEFIEntryView + + + Move up + 上移 + + + + Move down + 下移 + + + + Make default + 设为默认 + + + + Set reboot + 设为重启 + + + + Timeout: %1 second(s) + 超时:%1 秒 + + + + + + Add + 添加 + + + + + + Import + 导入 + + + + Save + 保存 + + + + Reset + 重置 + + + + Reboot to + 重启到 + + + + Do you want to reboot now? + 您想现在就重启吗? + + + + Export failed + 导出失败 + + + + Data to export is empty. + 导出的数据为空。 + + + + Export Boot%1 + 导出 Boot%1 + + + + Disable + 禁用 + + + + Enable + 启用 + + + + Delete + 删除 + + + + Export + 导出 + + + + Property + 属性 + + + + + + + + Import failed + 导入失败 + + + + + Data are invalidated. + 数据无效。 + + + + Choose an ID + 选择一个 ID + + + + Hex value from 0 to FFFF + 0 到 FFFF 的十六进制值 + + + + + + The action is cancelled. + 操作已取消。 + + + + The chosen ID is invalidated. + 选择的 ID 无效。 + + + + + Do you want to override Boot%1? + 您想覆盖 Boot%1 吗? + + + + + + Data might be invalidated. + 数据可能无效。 + + + + + + + Add failed + 添加失败 + + + + QEFILoadOptionEditorView + + + ID: + ID: + + + + Name: + 名称: + + + + Optional Data: + 可选数据: + + + + Add Device Path + 添加设备路径 + + + + Clear Device Path + 清除设备路径 + + + + Device Path: + 设备路径: + + + + QObject + + + Error + 错误 + + + + Permission insufficient or no EFI environment + 权限不足或非 EFI 环境 + + + diff --git a/translations/translations.qrc b/translations/translations.qrc new file mode 100644 index 0000000..43f3773 --- /dev/null +++ b/translations/translations.qrc @@ -0,0 +1,7 @@ + + + app_en.qm + app_fr.qm + app_zh.qm + + \ No newline at end of file