From dbe55c2fa80c91adce7f1f3dcdeb581e0ee738d5 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 5 Sep 2016 22:38:39 -0700 Subject: [PATCH] Qt: Fix translation interface --- src/platform/qt/CMakeLists.txt | 9 +- src/platform/qt/GBAApp.cpp | 7 + src/platform/qt/ts.cmake | 6 + src/platform/qt/ts/{es.ts => mgba-es.ts} | 1353 +--------------------- 4 files changed, 34 insertions(+), 1341 deletions(-) create mode 100644 src/platform/qt/ts.cmake rename src/platform/qt/ts/{es.ts => mgba-es.ts} (54%) diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index db81a6282..7abc03f6a 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -189,13 +189,18 @@ endif() find_package(Qt5LinguistTools) if(Qt5LinguistTools_FOUND) set(TRANSLATION_FILES) - file(GLOB TS_FILES ts/*.ts) + set(TRANSLATION_QRC "${CMAKE_CURRENT_BINARY_DIR}/ts.qrc") + file(GLOB TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/ts/${BINARY_NAME}-*.ts") if(UPDATE_TRANSLATIONS) qt5_create_translation(TRANSLATION_FILES ${SOURCE_FILES} ${UI_FILES} ${TS_FILES}) else() qt5_add_translation(TRANSLATION_FILES ${TS_FILES}) endif() - list(APPEND RESOURCES ${TRANSLATION_FILES}) + add_custom_command(OUTPUT ${TRANSLATION_QRC} + COMMAND ${CMAKE_COMMAND} -DTRANSLATION_QRC:FILEPATH="${TRANSLATION_QRC}" -DTRANSLATION_FILES="${TRANSLATION_FILES}" -P "${CMAKE_CURRENT_SOURCE_DIR}/ts.cmake" + DEPENDS ${TRANSLATION_FILES}) + qt5_add_resources(TRANSLATION_RESOURCES ${TRANSLATION_QRC}) + list(APPEND RESOURCES ${TRANSLATION_RESOURCES}) endif() add_executable(${BINARY_NAME}-qt WIN32 MACOSX_BUNDLE main.cpp ${CMAKE_SOURCE_DIR}/res/mgba.icns ${SOURCE_FILES} ${PLATFORM_SRC} ${UI_FILES} ${AUDIO_SRC} ${RESOURCES}) diff --git a/src/platform/qt/GBAApp.cpp b/src/platform/qt/GBAApp.cpp index 93db50bcc..b369c4d14 100644 --- a/src/platform/qt/GBAApp.cpp +++ b/src/platform/qt/GBAApp.cpp @@ -14,6 +14,7 @@ #include #include #include +#include extern "C" { #include "core/version.h" @@ -43,6 +44,12 @@ GBAApp::GBAApp(int& argc, char* argv[]) setWindowIcon(QIcon(":/res/mgba-1024.png")); #endif + QTranslator* translator = new QTranslator(this); + if (translator->load(QLocale("es"), QLatin1String(binaryName), QLatin1String("-"), QLatin1String(":/translations"))) { + installTranslator(translator); + } + + SocketSubsystemInit(); qRegisterMetaType("const uint32_t*"); qRegisterMetaType("mCoreThread*"); diff --git a/src/platform/qt/ts.cmake b/src/platform/qt/ts.cmake new file mode 100644 index 000000000..0c1e3c9bb --- /dev/null +++ b/src/platform/qt/ts.cmake @@ -0,0 +1,6 @@ +file(WRITE ${TRANSLATION_QRC} "\n\t\n") +foreach(TS ${TRANSLATION_FILES}) + get_filename_component(TS_BASE "${TS}" NAME) + file(APPEND ${TRANSLATION_QRC} "\t\t${TS_BASE}\n") +endforeach() +file(APPEND ${TRANSLATION_QRC} "\t\n") diff --git a/src/platform/qt/ts/es.ts b/src/platform/qt/ts/mgba-es.ts similarity index 54% rename from src/platform/qt/ts/es.ts rename to src/platform/qt/ts/mgba-es.ts index 6829dd939..0aaa54c5a 100644 --- a/src/platform/qt/ts/es.ts +++ b/src/platform/qt/ts/mgba-es.ts @@ -1,45 +1,37 @@ - + AboutScreen - About - {projectName} - - + © 2013 – 2016 Jeffrey Pfau — Game Boy Advance is a registered trademark of Nintendo Co., Ltd. - {projectVersion} - {logo} - {projectName} is an open-source Game Boy Advance emulator - - + <a href="http://mgba.io/">Website</a> • <a href="https://forums.mgba.io/">Forums / Support</a> • <a href="https://github.com/mgba-emu/mgba/tree/{gitBranch}">Source</a> • <a href="https://github.com/mgba-emu/mgba/blob/{gitBranch}/LICENSE">License</a> - Branch: <tt>{gitBranch}</tt><br/>Revision: <tt>{gitCommit}</tt> @@ -47,7 +39,6 @@ ArchiveInspector - Open in archive... @@ -55,330 +46,57 @@ CheatsView - Cheats - Remove - Save - Load - Add New Set - Add - - Form - - - - Form - - - - - Audio driver: - - - - - Audio buffer: - - - - - - 1536 - - - - - 512 - - - - - 768 - - - - - 1024 - - - - - 2048 - - - - - 3072 - - - - - 4096 - - - - - samples - - - - - Sample rate: - - - - - - 44100 - - - - - 22050 - - - - - 32000 - - - - - 48000 - - - - - Hz - - - - - Volume: - - - - - Mute - - - - - Display driver: - - - - - Frameskip: - - - - - Skip every - - - - - - frames - - - - - FPS target: - - - - - frames per second - - - - - Sync: - - - - - Video - - - - - Audio - - - - - Lock aspect ratio - - - - - Resample video - - - - - BIOS file: - - - - - Browse - - - - - Use BIOS file - - - - - Skip BIOS intro - - - - - Enable rewind - - - - - Create rewind state: - - - - - Every - - - - - Rewind history: - - - - - states - - - - - Fast forward speed - - - - - × - - - - - Unbounded - - - - - Allow opposing input directions - - - - - Suspend screensaver - - - - - Idle loops - - - - - Run all - - - - - Remove known - - - - - Detect and remove - - - - - GBAKeyEditor - - - Form - - - - - Set All - - - GIFView - Record GIF - Start - Stop - Select File - Frameskip - Frame delay (ms) - Automatic @@ -386,172 +104,121 @@ IOViewer - I/O Viewer - 0x0000 - 2 - 5 - 4 - 7 - 0 - 9 - 1 - 3 - 8 - C - E - 6 - D - F - A - B - - KeyEditor - - - Form - - - - - KeyName - - - LoadSaveState - - %1 State - - - - - - - - - No Save - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 @@ -559,57 +226,46 @@ LogView - Logs - Enabled Levels - Debug - Stub - Info - Warning - Error - Fatal - Game Error - Clear - Max Lines @@ -617,47 +273,38 @@ MemoryView - Memory - Inspect Address: - 0x - Set Alignment: - 1 Byte - 2 Bytes - 4 Bytes - Signed Integer: - Unsigned Integer: @@ -665,83 +312,66 @@ OverrideView - Game Overrides - Save - Save type - - Autodetect - None - SRAM - Flash 512kb - Flash 1Mb - EEPROM - Idle loop - Game Boy Player features - Realtime clock - Gyroscope - Tilt - Light sensor - Rumble @@ -749,131 +379,77 @@ PaletteView - Palette - Background - Objects - Selection - Red - Green - Blue - - - 0x00 (00) - 16-bit value - Hex code - Palette index - 0x0000 - #000000 - 000 - Export BG - Export OBJ - - QGBA::AudioDevice - - - Can't set format of context-less audio device - - - - - Audio device is missing its core - - - - - Writing data to read-only audio device - - - - - QGBA::AudioProcessorQt - - - Can't start an audio processor without input - - - - - QGBA::AudioProcessorSDL - - - Can't start an audio processor without input - - - QGBA::CheatsModel - (untitled) - Failed to open cheats file: %1 @@ -881,8 +457,6 @@ QGBA::CheatsView - - Select cheats file @@ -890,83 +464,33 @@ QGBA::GBAKeyEditor - Clear Button - Clear Analog - Refresh - Set all - - QGBA::GDBWindow - - - Server settings - - - - - Local port - - - - - Bind address - - - - - Break - - - - - Stop - - - - - Start - - - - - Crash - - - - - Could not start GDB server - - - QGBA::GIFView - Failed to open output GIF file: %1 - Select output file - Graphics Interchange Format (*.gif) @@ -974,28 +498,22 @@ QGBA::GameController - - Failed to open game file: %1 - Failed to open save file: %1 - Failed to open snapshot file for reading: %1 - Failed to open snapshot file for writing: %1 - Failed to start audio processor @@ -1003,1367 +521,882 @@ QGBA::IOViewer - Background mode - Mode 0: 4 tile layers - Mode 1: 2 tile layers + 1 rotated/scaled tile layer - Mode 2: 2 rotated/scaled tile layers - Mode 3: Full 15-bit bitmap - Mode 4: Full 8-bit bitmap - Mode 5: Small 15-bit bitmap - CGB Mode - Frame select - Unlocked HBlank - Linear OBJ tile mapping - Force blank screen - Enable background 0 - Enable background 1 - Enable background 2 - Enable background 3 - Enable OBJ - Enable Window 0 - Enable Window 1 - Enable OBJ Window - Currently in VBlank - Currently in HBlank - Currently in VCounter - Enable VBlank IRQ generation - Enable HBlank IRQ generation - Enable VCounter IRQ generation - VCounter scanline - Current scanline - - - - Priority - - - - Tile data base (* 16kB) - - - - Enable mosaic - - - - Enable 256-color - - - - Tile map base (* 2kB) - - - - Background dimensions - - Overflow wraps - - - - Horizontal offset - - - - Vertical offset - - - - - - - - - - - - Fractional part - - - - - - - - Integer part - - - - Integer part (bottom) - - - - Integer part (top) - - End x - - Start x - - End y - - Start y - Window 0 enable BG 0 - Window 0 enable BG 1 - Window 0 enable BG 2 - Window 0 enable BG 3 - Window 0 enable OBJ - Window 0 enable blend - Window 1 enable BG 0 - Window 1 enable BG 1 - Window 1 enable BG 2 - Window 1 enable BG 3 - Window 1 enable OBJ - Window 1 enable blend - Outside window enable BG 0 - Outside window enable BG 1 - Outside window enable BG 2 - Outside window enable BG 3 - Outside window enable OBJ - Outside window enable blend - OBJ window enable BG 0 - OBJ window enable BG 1 - OBJ window enable BG 2 - OBJ window enable BG 3 - OBJ window enable OBJ - OBJ window enable blend - Background mosaic size vertical - Background mosaic size horizontal - Object mosaic size vertical - Object mosaic size horizontal - BG 0 target 1 - BG 1 target 1 - BG 2 target 1 - BG 3 target 1 - OBJ target 1 - Backdrop target 1 - Blend mode - Disabled - Additive blending - Brighten - Darken - BG 0 target 2 - BG 1 target 2 - BG 2 target 2 - BG 3 target 2 - OBJ target 2 - Backdrop target 2 - Blend A (target 1) - Blend B (target 2) - Blend Y - Sweep shifts - Sweep subtract - Sweep time (in 1/128s) - - - - Sound length - - Duty cycle - - - Envelope step time - - - Envelope increase - - - Initial volume - - - Sound frequency - - - - Timed - - - - Reset - Double-size wave table - Active wave table - Enable channel 3 - Volume - 0% - - 100% - - 50% - - 25% - - - - 75% - Clock divider - Register stages - 15 - 7 - Shifter frequency - PSG volume right - PSG volume left - Enable channel 1 right - Enable channel 2 right - Enable channel 3 right - Enable channel 4 right - Enable channel 1 left - Enable channel 2 left - Enable channel 3 left - Enable channel 4 left - PSG master volume - Loud channel A - Loud channel B - Enable channel A right - Enable channel A left - Channel A timer - - 0 - - - - - - - - - 1 - Channel A reset - Enable channel B right - Enable channel B left - Channel B timer - Channel B reset - Active channel 1 - Active channel 2 - Active channel 3 - Active channel 4 - Enable audio - Bias - Resolution - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Sample - - - - - - - - Address (bottom) - - - - - - - - Address (top) - - - - Word count - - - - Destination offset - - - - - - - - Increment - - - - - - - - Decrement - - - - - - - - Fixed - - - - Increment and reload - - - - Source offset - - - - Repeat - - - - 32-bit - - - - Start timing - - - - Immediate - - - - - - VBlank - - - - - - HBlank - - - - - - - - - IRQ - - - - - - - - Enable - - - Audio FIFO - Video Capture - DRQ - - - - Value - - - - Scale - - - - 1/64 - - - - 1/256 - - - - 1/1024 - - - Cascade - - A - - B - - Select - - Start - - Right - - Left - - Up - - Down - - R - - L - Condition - SC - SD - SI - SO - - VCounter - - Timer 0 - - Timer 1 - - Timer 2 - - Timer 3 - - SIO - - DMA 0 - - DMA 1 - - DMA 2 - - DMA 3 - - Keypad - - Gamepak - SRAM wait - - - - - 4 - - - - 3 - - - - - 2 - - - - - 8 - Cart 0 non-sequential - Cart 0 sequential - Cart 1 non-sequential - Cart 1 sequential - Cart 2 non-sequential - Cart 2 sequential - PHI terminal - Disable - 4.19MHz - 8.38MHz - 16.78MHz - Gamepak prefetch - Enable IRQs @@ -2371,8 +1404,6 @@ QGBA::KeyEditor - - --- @@ -2380,12 +1411,10 @@ QGBA::LibraryModel - Filename - Size @@ -2393,27 +1422,22 @@ QGBA::LoadSaveState - Load State - Save State - Empty - Corrupted - Slot %1 @@ -2421,37 +1445,30 @@ QGBA::LogController - DEBUG - STUB - INFO - WARN - ERROR - FATAL - GAME ERROR @@ -2459,33 +1476,26 @@ QGBA::MemoryModel - Copy selection - Save selection - - All - Save selected memory - Failed to open output file: %1 - ASCII @@ -2493,39 +1503,30 @@ QGBA::PaletteView - #%0 - 0x%0 - %0 - - - 0x%0 (%1) - Export palette - Windows PAL (*.pal);;Adobe Color Table (*.act) - Failed to open output palette file: %1 @@ -2533,22 +1534,14 @@ QGBA::ROMInfo - - - - - (unknown) - - bytes - (no database present) @@ -2556,32 +1549,26 @@ QGBA::SettingsView - Qt Multimedia - SDL - Software (Qt) - OpenGL - OpenGL (force version 1.x) - Select BIOS @@ -2589,37 +1576,30 @@ QGBA::ShaderSelector - No shader active - Load shader - %1 Shader (%.shader) - No shader loaded - by %1 - Preprocessing - Pass %1 @@ -2627,17 +1607,14 @@ QGBA::ShortcutController - Action - Keyboard - Gamepad @@ -2645,8 +1622,6 @@ QGBA::TileView - - 0x%0 @@ -2654,12 +1629,10 @@ QGBA::VideoView - Failed to open output video file: %1 - Select output file @@ -2667,690 +1640,548 @@ QGBA::Window - Game Boy Advance ROMs (%1) - Game Boy ROMs (%1) - All ROMs (%1) - Archives (%1) - - - Select ROM - Game Boy Advance save files (%1) - - - Select save - Select BIOS - Select patch - Patches (*.ips *.ups *.bps) - - GameShark saves (*.sps *.xps) - Crash - The game has crashed with the following error: %1 - Couldn't Load - Could not load game. Are you sure it's in the correct format? - Unimplemented BIOS call - This game uses a BIOS call that is not implemented. Please use the official BIOS for best experience. - Really make portable? - This will make the emulator load its configuration from the same directory as the executable. Do you want to continue? - Restart needed - Some changes will not take effect until the emulator is restarted. - - Player %1 of %2 - %1 - %2 - %1 - %2 - %3 - %1 - %2 (%3 fps) - %4 - &File - Load &ROM... - Load ROM in archive... - Load &BIOS... - Load temporary save... - Load &patch... - Boot BIOS - Replace ROM... - ROM &info... - Recent - Make portable - &Load state - F10 - &Save state - Shift+F10 - Quick load - Quick save - Load recent - Save recent - Undo load state - F11 - Undo save state - Shift+F11 - - State &%1 - F%1 - Shift+F%1 - Import GameShark Save - Export GameShark Save - New multiplayer window - About - E&xit - &Emulation - &Reset - Ctrl+R - Sh&utdown - Yank game pak - &Pause - Ctrl+P - &Next frame - Ctrl+N - Fast forward (held) - &Fast forward - Shift+Tab - Fast forward speed - Unbounded - %0x - Rewind (held) - Re&wind - ` - Step backwards - Ctrl+B - Sync to &video - Sync to &audio - Solar sensor - Increase solar level - Decrease solar level - Brightest solar level - Darkest solar level - Brightness %1 - Audio/&Video - Frame size - %1x - Toggle fullscreen - Lock aspect ratio - Resample video - Frame&skip - Shader options... - Mute - FPS target - 15 - 30 - 45 - Native (59.7) - 60 - 90 - 120 - 240 - Take &screenshot - F12 - Record output... - Record GIF... - Video layers - Background %0 - OBJ (sprites) - Audio channels - Channel %0 - Channel A - Channel B - &Tools - View &logs... - Game &overrides... - Game &Pak sensors... - &Cheats... - Start &GDB server... - Settings... - View &palette... - View &tiles... - View memory... - View &I/O registers... - Exit fullscreen - Autofire - Autofire A - Autofire B - Autofire L - Autofire R - Autofire Start - Autofire Select - Autofire Up - Autofire Right - Autofire Down - Autofire Left @@ -3358,57 +2189,46 @@ ROMInfo - ROM Info - Game name: - {NAME} - Internal name: - {TITLE} - Game ID: - {ID} - File size: - {SIZE} - CRC32: - {CRC} @@ -3416,74 +2236,58 @@ SensorView - Sensors - Realtime clock - Fixed time - System time - Start time at - Now - MM/dd/yy hh:mm:ss AP - Light sensor - Brightness - Tilt sensor - - Set Y - - Set X - Gyroscope - Sensitivity @@ -3491,315 +2295,242 @@ SettingsView - Settings - Audio/Video - Emulation - Savestates - Paths - Audio driver: - Audio buffer: - - - 1536 - - - - 512 - 768 - 1024 - + 1536 + + + 2048 - 3072 - 4096 - samples - Sample rate: - - - 44100 - - - - 22050 - 32000 - + 44100 + + + 48000 - Hz - Volume: - Mute - Display driver: - Frameskip: - Skip every - - frames - FPS target: - frames per second - Sync: - Video - Audio - Lock aspect ratio - Resample video - BIOS file: - - - - - Browse - Use BIOS file if found - Skip BIOS intro - Fast forward speed - - + × - Unbounded - Suspend screensaver - Pause when inactive - Idle loops - Run all - Remove known - Detect and remove - Allow opposing input directions - Save extra data - - Screenshot - - Save data - - Cheat codes - Load extra data - Enable rewind - Rewind history: - Save games - - - - Same directory as the ROM - Save states - Screenshots - Patches @@ -3807,37 +2538,30 @@ ShaderSelector - Shaders - Active Shader: - Name - Author - Description - Unload Shader - Load New Shader @@ -3845,22 +2569,18 @@ ShortcutView - Edit Shortcuts - Keyboard - Gamepad - Clear @@ -3868,42 +2588,34 @@ TileView - Tiles - 256 colors - Tile # - 0 - Address - 0x06000000 - - + × - Magnification @@ -3911,183 +2623,146 @@ VideoView - Record Video - Start - Stop - Select File - Presets - High Quality - YouTube - - WebM - Lossless - 1080p - 720p - 480p - GBA (240x160) - Format - MKV - AVI - MP4 - PNG - h.264 - VP8 - Xvid - FFV1 - FLAC - Opus - Vorbis - MP3 - AAC - Uncompressed - Bitrate (kbps) - VBR - ABR - Dimensions - : - - + × - Lock aspect ratio - Show advanced