From 7b7f09f0a06a20f040a3edb04995626cfb4d6881 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Wed, 4 Dec 2024 01:01:48 +0200 Subject: [PATCH] Translation PoC --- CMakeLists.txt | 20 +- docs/translations/el.ts | 728 ++++++++++++++++++++++++++++++++++ docs/translations/en.ts | 730 +++++++++++++++++++++++++++++++++++ src/panda_qt/main_window.cpp | 25 ++ 4 files changed, 1502 insertions(+), 1 deletion(-) create mode 100644 docs/translations/el.ts create mode 100644 docs/translations/en.ts diff --git a/CMakeLists.txt b/CMakeLists.txt index 224fea7c..42a5d402 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -637,7 +637,7 @@ if(NOT BUILD_HYDRA_CORE AND NOT BUILD_LIBRETRO_CORE) add_executable(Alber) if(ENABLE_QT_GUI) - find_package(Qt6 REQUIRED COMPONENTS Widgets) + find_package(Qt6 REQUIRED COMPONENTS Widgets LinguistTools) if(NOT ENABLE_OPENGL) message(FATAL_ERROR "Qt frontend requires OpenGL") endif() @@ -700,6 +700,24 @@ if(NOT BUILD_HYDRA_CORE AND NOT BUILD_LIBRETRO_CORE) docs/img/sparkling_icon.png docs/img/battery_icon.png docs/img/sdcard_icon.png docs/img/rnap_icon.png docs/img/rcow_icon.png docs/img/skyemu_icon.png ) + + set(QT_TRANSLATIONS "${PROJECT_SOURCE_DIR}/docs/translations") + file(GLOB_RECURSE TRANSLATIONS_TS ${QT_TRANSLATIONS}/*.ts) + + set_source_files_properties(${TRANSLATIONS_TS} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations") + qt_add_translation(TRANSLATIONS_QM ${TRANSLATIONS_TS}) + + set(TRANSLATIONS_QRC ${CMAKE_CURRENT_BINARY_DIR}/translations/translations.qrc) + file(WRITE ${TRANSLATIONS_QRC} "\n") + foreach (QM ${TRANSLATIONS_QM}) + message("${QM}") + get_filename_component(QM_FILE ${QM} NAME) + file(APPEND ${TRANSLATIONS_QRC} "${QM_FILE}\n") + endforeach (QM) + file(APPEND ${TRANSLATIONS_QRC} "") + + qt_add_resources(TRANSLATIONS ${TRANSLATIONS_QRC}) + set(APP_RESOURCES ${APP_RESOURCES} ${TRANSLATIONS}) else() set(FRONTEND_SOURCE_FILES src/panda_sdl/main.cpp src/panda_sdl/frontend_sdl.cpp src/panda_sdl/mappings.cpp) set(FRONTEND_HEADER_FILES "include/panda_sdl/frontend_sdl.hpp") diff --git a/docs/translations/el.ts b/docs/translations/el.ts new file mode 100644 index 00000000..241f2bff --- /dev/null +++ b/docs/translations/el.ts @@ -0,0 +1,728 @@ + + + AboutWindow + + + About Panda3DS + + + + + Panda3DS is a free and open source Nintendo 3DS emulator, for Windows, MacOS and Linux + + + + + Visit panda3ds.com for help with Panda3DS and links to our official support sites. + + + + + Panda3DS is developed by volunteers in their spare time. Below is a list of some of these volunteers who've agreed to be listed here, in no particular order.<br>If you think you should be listed here too, please inform us<br><br>- Peach (wheremyfoodat)<br>- noumidev<br>- liuk707<br>- Wunk<br>- marysaka<br>- Sky<br>- merryhime<br>- TGP17<br>- Shadow<br> + + + + + CheatEditDialog + + + Edit Cheat + + + + + Cheat name + + + + + CheatEntryWidget + + + Edit + + + + + CheatsWindow + + + Cheats + + + + + Add + + + + + Remove + + + + + ConfigWindow + + + Configuration + + + + + Interface Settings + + + + + System + + + + + Light + + + + + Dark + + + + + Greetings Cat + + + + + Cream + + + + + Color theme + + + + + Happy panda + + + + + Happy panda (colourful) + + + + + Sleepy panda + + + + + Cow panda + + + + + The penguin from SkyEmu + + + + + Window icon + + + + + Show version on window title + + + + + Remember window position + + + + + General Settings + + + + + Browse... + + + + + Select Directory + + + + + Default ROMs path + + + + + Enable Discord RPC + + + + + Use portable build + + + + + Print version in console output + + + + + Graphics Settings + + + + + + Null + + + + + OpenGL + + + + + Vulkan + + + + + GPU renderer + + + + + Enable Renderdoc + + + + + Enable shader JIT + + + + + Enable VSync + + + + + Use ubershaders (No stutter, maybe slower) + + + + + Accurate shader multiplication + + + + + Accelerate shaders + + + + + Force shadergen when rendering lights + + + + + Light threshold for forcing shadergen + + + + + Audio Settings + + + + + LLE + + + + + HLE + + + + + DSP emulation + + + + + Enable audio + + + + + Enable AAC audio + + + + + Print DSP firmware + + + + + Mute audio device + + + + + Cubic + + + + + Linear + + + + + Volume curve + + + + + Audio device volume + + + + + Battery Settings + + + + + Battery percentage + + + + + Charger plugged + + + + + SD Card Settings + + + + + Enable virtual SD card + + + + + Write protect virtual SD card + + + + + Interface + + + + + User Interface settings + + + + + General + + + + + General emulator settings + + + + + Graphics + Γραφικά + + + + Graphics emulation and output settings + + + + + Audio + Ήχος + + + + Audio emulation and output settings + + + + + Battery + + + + + Battery emulation settings + + + + + SD Card + + + + + SD Card emulation settings + + + + + MainWindow + + + Alber + Αλβέρτος + + + + File + + + + + Emulation + + + + + Tools + + + + + About + + + + + Load game + + + + + Load Lua script + + + + + Open Panda3DS folder + + + + + Pause + + + + + Resume + + + + + Reset + + + + + Configure + + + + + Dump RomFS + + + + + Open Lua Editor + + + + + Open Cheats Editor + + + + + Open Patch Window + + + + + Open Shader Editor + + + + + Dump loaded DSP firmware + + + + + About Panda3DS + + + + + Select 3DS ROM to load + + + + + Nintendo 3DS ROMs (*.3ds *.cci *.cxi *.app *.ncch *.3dsx *.elf *.axf) + + + + + Select Lua script to load + + + + + Lua scripts (*.lua *.txt) + + + + + Select folder to dump RomFS files to + + + + + Invalid format for RomFS dumping + + + + + The currently loaded app is not in a format that supports RomFS + + + + + + + OK + + + + + No RomFS found + + + + + No RomFS partition was found in the loaded app + + + + + Select file + + + + + DSP firmware file (*.cdc) + + + + + No DSP firmware loaded + + + + + The currently loaded app has not uploaded a firmware to the DSP + + + + + Failed to open output file + + + + + The currently loaded DSP firmware could not be written to the selected file. Please make sure you have permission to access this file + + + + + PatchWindow + + + ROM patcher + + + + + Select input file + + + + + + Select + + + + + + Select patch file + + + + + Apply patch + + + + + Select file to patch + + + + + + All files (*.*) + + + + + Patch files (*.ips *.ups *.bps) + + + + + Paths not provided correctly + + + + + Please provide paths for both the input file and the patch file + + + + + Select file + + + + + No output path + + + + + No path was provided for the output file, no patching was done + + + + + Unknown patch format + + + + + Unknown format for patch file. Currently IPS, UPS and BPS are supported + + + + + Failed to open input files + + + + + Make sure they're in a directory Panda3DS has access to + + + + + Patching Success + + + + + Your file was patched successfully. + + + + + Checksum mismatch + + + + + Patch was applied successfully but a checksum mismatch was detected. The input or output files might not be correct + + + + + Patching error + + + + + An error occured while patching + + + + + PatchWindow::PatchWindow + + + OK + + + + + ShaderEditorWindow + + + Reload shader + + + + + TextEditorWindow + + + Lua Editor + + + + + Load script + + + + \ No newline at end of file diff --git a/docs/translations/en.ts b/docs/translations/en.ts new file mode 100644 index 00000000..e28dcd7b --- /dev/null +++ b/docs/translations/en.ts @@ -0,0 +1,730 @@ + + + + + AboutWindow + + + About Panda3DS + + + + + Panda3DS is a free and open source Nintendo 3DS emulator, for Windows, MacOS and Linux + + + + + Visit panda3ds.com for help with Panda3DS and links to our official support sites. + + + + + Panda3DS is developed by volunteers in their spare time. Below is a list of some of these volunteers who've agreed to be listed here, in no particular order.<br>If you think you should be listed here too, please inform us<br><br>- Peach (wheremyfoodat)<br>- noumidev<br>- liuk707<br>- Wunk<br>- marysaka<br>- Sky<br>- merryhime<br>- TGP17<br>- Shadow<br> + + + + + CheatEditDialog + + + Edit Cheat + + + + + Cheat name + + + + + CheatEntryWidget + + + Edit + + + + + CheatsWindow + + + Cheats + + + + + Add + + + + + Remove + + + + + ConfigWindow + + + Configuration + + + + + Interface Settings + + + + + System + + + + + Light + + + + + Dark + + + + + Greetings Cat + + + + + Cream + + + + + Color theme + + + + + Happy panda + + + + + Happy panda (colourful) + + + + + Sleepy panda + + + + + Cow panda + + + + + The penguin from SkyEmu + + + + + Window icon + + + + + Show version on window title + + + + + Remember window position + + + + + General Settings + + + + + Browse... + + + + + Select Directory + + + + + Default ROMs path + + + + + Enable Discord RPC + + + + + Use portable build + + + + + Print version in console output + + + + + Graphics Settings + + + + + + Null + + + + + OpenGL + + + + + Vulkan + + + + + GPU renderer + + + + + Enable Renderdoc + + + + + Enable shader JIT + + + + + Enable VSync + + + + + Use ubershaders (No stutter, maybe slower) + + + + + Accurate shader multiplication + + + + + Accelerate shaders + + + + + Force shadergen when rendering lights + + + + + Light threshold for forcing shadergen + + + + + Audio Settings + + + + + LLE + + + + + HLE + + + + + DSP emulation + + + + + Enable audio + + + + + Enable AAC audio + + + + + Print DSP firmware + + + + + Mute audio device + + + + + Cubic + + + + + Linear + + + + + Volume curve + + + + + Audio device volume + + + + + Battery Settings + + + + + Battery percentage + + + + + Charger plugged + + + + + SD Card Settings + + + + + Enable virtual SD card + + + + + Write protect virtual SD card + + + + + Interface + + + + + User Interface settings + + + + + General + + + + + General emulator settings + + + + + Graphics + + + + + Graphics emulation and output settings + + + + + Audio + + + + + Audio emulation and output settings + + + + + Battery + + + + + Battery emulation settings + + + + + SD Card + + + + + SD Card emulation settings + + + + + MainWindow + + + Alber + + + + + File + + + + + Emulation + + + + + Tools + + + + + About + + + + + Load game + + + + + Load Lua script + + + + + Open Panda3DS folder + + + + + Pause + + + + + Resume + + + + + Reset + + + + + Configure + + + + + Dump RomFS + + + + + Open Lua Editor + + + + + Open Cheats Editor + + + + + Open Patch Window + + + + + Open Shader Editor + + + + + Dump loaded DSP firmware + + + + + About Panda3DS + + + + + Select 3DS ROM to load + + + + + Nintendo 3DS ROMs (*.3ds *.cci *.cxi *.app *.ncch *.3dsx *.elf *.axf) + + + + + Select Lua script to load + + + + + Lua scripts (*.lua *.txt) + + + + + Select folder to dump RomFS files to + + + + + Invalid format for RomFS dumping + + + + + The currently loaded app is not in a format that supports RomFS + + + + + + + OK + + + + + No RomFS found + + + + + No RomFS partition was found in the loaded app + + + + + Select file + + + + + DSP firmware file (*.cdc) + + + + + No DSP firmware loaded + + + + + The currently loaded app has not uploaded a firmware to the DSP + + + + + Failed to open output file + + + + + The currently loaded DSP firmware could not be written to the selected file. Please make sure you have permission to access this file + + + + + PatchWindow + + + ROM patcher + + + + + Select input file + + + + + + Select + + + + + + Select patch file + + + + + Apply patch + + + + + Select file to patch + + + + + + All files (*.*) + + + + + Patch files (*.ips *.ups *.bps) + + + + + Paths not provided correctly + + + + + Please provide paths for both the input file and the patch file + + + + + Select file + + + + + No output path + + + + + No path was provided for the output file, no patching was done + + + + + Unknown patch format + + + + + Unknown format for patch file. Currently IPS, UPS and BPS are supported + + + + + Failed to open input files + + + + + Make sure they're in a directory Panda3DS has access to + + + + + Patching Success + + + + + Your file was patched successfully. + + + + + Checksum mismatch + + + + + Patch was applied successfully but a checksum mismatch was detected. The input or output files might not be correct + + + + + Patching error + + + + + An error occured while patching + + + + + PatchWindow::PatchWindow + + + OK + + + + + ShaderEditorWindow + + + Reload shader + + + + + TextEditorWindow + + + Lua Editor + + + + + Load script + + + + diff --git a/src/panda_qt/main_window.cpp b/src/panda_qt/main_window.cpp index 5af31d73..14ea19b0 100644 --- a/src/panda_qt/main_window.cpp +++ b/src/panda_qt/main_window.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,30 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent) emu = new Emulator(); emu->setOutputSize(screen->surfaceWidth, screen->surfaceHeight); + QTranslator* translator = nullptr; + auto language = QString::fromStdString("el"); + const QString baseDir = QStringLiteral(":/translations"); + QString basePath = QStringLiteral("%1/%2.qm").arg(baseDir).arg(language); + + if (QFile::exists(basePath)) { + if (translator != nullptr) { + qApp->removeTranslator(translator); + } + + translator = new QTranslator(qApp); + if (!translator->load(basePath)) { + QMessageBox::warning( + nullptr, QStringLiteral("Translation Error"), + QStringLiteral("Failed to find load translation file for '%1':\n%2").arg(language).arg(basePath) + ); + delete translator; + } else { + qApp->installTranslator(translator); + } + } else { + printf("%s does not exist\n", basePath.toStdString().c_str()); + } + // Set up misc objects aboutWindow = new AboutWindow(nullptr); cheatsEditor = new CheatsWindow(emu, {}, this);