From 815d15728d1c050bb43494f6b4cdb616acc81e10 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sun, 21 Jul 2013 16:06:39 +0200 Subject: [PATCH] Work on localization. --- CMakeLists.txt | 2 +- localization/rssguard_cs.ts | 401 +++++++++++++++++++++++++++++++++++- localization/rssguard_en.ts | 387 +++++++++++++++++++++++++++++++++- src/core/localization.cpp | 30 --- src/core/localization.h | 28 ++- src/main.cpp | 4 +- 6 files changed, 803 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 383f6871d..22cc02374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,6 +359,6 @@ add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) # make lupdate and make lrelease implementation. add_custom_target(lupdate ${Qt5Core_QMAKE_EXECUTABLE} -project -o ${CMAKE_CURRENT_BINARY_DIR}/${APP_LOW_NAME}.pro - COMMAND ${Qt5_LUPDATE_EXECUTABLE} -ts ${APP_TRANSLATIONS_WO_QT} -no-obsolete -pro ${CMAKE_CURRENT_BINARY_DIR}/${APP_LOW_NAME}.pro + COMMAND ${Qt5_LUPDATE_EXECUTABLE} -ts ${APP_TRANSLATIONS_WO_QT} -pro ${CMAKE_CURRENT_BINARY_DIR}/${APP_LOW_NAME}.pro WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) diff --git a/localization/rssguard_cs.ts b/localization/rssguard_cs.ts index 98e240f8c..bbf0b52fe 100644 --- a/localization/rssguard_cs.ts +++ b/localization/rssguard_cs.ts @@ -1,6 +1,112 @@ + + BaseWebView + + Reload web page + Obnovit stránku + + + Reload current web page + Znovu načíst aktuální stránku + + + Copy link url + Kopírovat adresu odkazu + + + Copy link url to clipboard + Kopírovat adresu odkazu to schránky + + + Copy image + Kopírovat obrázek + + + Copy image to clipboard + Kopírovat obrázek do schránky + + + Copy image url + Kopírovat adresu obrázku + + + Copy image url to clipboard + Kopírovat adresu obrázku do schránky + + + Web browser + Webový prohlížeč + + + Image + Obrázek + + + + FormAbout + + About RSS Guard + O programu RSS Guard + + + Information + Informace + + + Licenses + Licence + + + GNU GPL License (applies to RSS Guard source code) + GNU GPL Licence (pro kód programu RSS Guard) + + + GNU GPL License + GNU GPL Licence + + + BSD License (applies to QtSingleApplication source code) + BSD Licence (pro komponentu QtSingleApplication) + + + Licenses page is available only in English language. + Stránka Licence je dostupná pouze v anglickém jazyce. + + + Thanks to + Poděkování + + + Changelog + Historie verzí + + + Changelog page is available only in English language. + Historie verzí je dostupná pouze v anglickém jazyce. + + + License not found. + Licence nenalezena. + + + Changelog not found. + Historie změn nenalezena. + + + <b>%8</b><br><b>Version:</b> %1 (build on %2 with CMake %3)<br><b>Revision:</b> %4<br><b>Build date:</b> %5<br><b>Qt:</b> %6 (compiled against %7)<br> + + + + <body>Authors and contributors:<ul><li>Martin Rotter (<a href="mailto://rotter.martinos@gmail.com">rotter.martinos@gmail.com</a>) (author of RSS Guard)</li><li>snakebite & tiheum (authors of KFaenza/Faenza icon theme)</li><li>Digia Plc (author of QtSingleApplication component)</li></ul></body> + + + + <body>RSS Guard is a (very) tiny feed reader.<br><br>This software is distributed under the terms of GNU General Public License, version 3 or later.<br><br>Contacts:<ul><li><a href="mailto://rotter.martinos@gmail.com">rotter.martinos@gmail</a> ~email</li><li><a href="http://www.rssguard.sf.net">www.rssguard.sf.net</a> ~website</li></ul>You can obtain source code for Qonverter from its website.<br><br><br>Copyright © 2011-%1 Martin Rotter</body> + + + FormMain @@ -13,43 +119,75 @@ &File - + &Soubor &Help - + &Pomoc &View - + &Zobrazit &Tools - + &Nástroje &Import - + &Importovat E&xport - + E&xportovat &Quit - + &Ukončit &Settings + Na&stavení + + + Tab 1 + + + + Tab 2 + + + + Ctrl+Shift+I + + + + Ctrl+Shift+E + + + + Ctrl+Shift+Q + + + + Ctrl+Shift+S + + + + &About RSS Guard + &O aplikaci RSS Guard + + + &Fullscreen mode + &Režime celé obrazovky + + + Ctrl+Shift+F FormSettings - - Dialog - - General @@ -66,6 +204,201 @@ system icon theme (default) + + Settings + + + + Keyboard shortcuts + + + + Language + + + + Proxy + + + + Launch RSS Guard on operating system startup + + + + Icons && skins + + + + Skin + + + + Notifications + + + + Tray icon + + + + disable + + + + enable + + + + When main window is closed, then + + + + hide it. + + + + quit the application. + + + + Start application hidden + + + + Web browser + + + + Color of website loading progress bar + + + + &Change... + + + + Use custom color for web browser progress bar + + + + Miscellaneous + + + + Type + + + + Host + + + + Hostname or IP of your proxy server + + + + Port + + + + Username + + + + Your username for proxy server authentication + + + + Password + + + + Your password for proxy server authentication + + + + Display password + + + + Password is stored in plain string in RSS Guard configuration file. + + + + Code + + + + Version + + + + Author + + + + Email + + + + Select color for web browser progress bar + + + + No proxy + + + + Socks5 + + + + Http + + + + Language of Qonverter was changed. Note that changes will take effect on next Qonverter start. + + + + Do you want to restart now? + + + + Language changed + + + + Problem with RSS Guard restart + + + + Qonverter couldn't be restarted, please restart it manually for changes to take effect. + + + + (not supported on this platform) + + + + disable (Tray icon is not available.) + + + + + FormWelcome + + Welcome + + + + Welcome to RSS Guard + + + + <html><head/><body><p>RSS Guard is a (very) easy feed reader. It supports all major feed formats, including RSS, ATOM and RDF.</p><p>Make sure you explore all available features. If you find a bug or if you want to propose new feature, then create new <a href="https://sourceforge.net/p/rssguard/tickets"><span style=" text-decoration: underline; color:#0000ff;">issue report</span></a>.</p><p>RSS Guard can be translated to any language. Contact its <a href="mailto:rotter.martinos@gmail.com"><span style=" text-decoration: underline; color:#0000ff;">author</span></a> in case of your interest.</p><p><br/></p></body></html> + + QObject @@ -95,4 +428,50 @@ rotter.martinos@gmail.com + + TrayIconMenu + + Close opened modal dialogs first. + + + + + WebBrowser + + Navigation panel + + + + Back + + + + Go back + Jít zpět + + + Forward + Zpět + + + Go forward + Jít vpřed + + + Reload + Obnovit + + + Reload current web page + Znovu načíst aktuální stránku + + + Stop + + + + Stop web page loading + + + diff --git a/localization/rssguard_en.ts b/localization/rssguard_en.ts index 92f81d0ef..cf261227b 100644 --- a/localization/rssguard_en.ts +++ b/localization/rssguard_en.ts @@ -1,6 +1,112 @@ + + BaseWebView + + Reload web page + + + + Reload current web page + + + + Copy link url + + + + Copy link url to clipboard + + + + Copy image + + + + Copy image to clipboard + + + + Copy image url + + + + Copy image url to clipboard + + + + Web browser + + + + Image + + + + + FormAbout + + About RSS Guard + + + + Information + + + + Licenses + + + + GNU GPL License (applies to RSS Guard source code) + + + + GNU GPL License + + + + BSD License (applies to QtSingleApplication source code) + + + + Licenses page is available only in English language. + + + + Thanks to + + + + Changelog + + + + Changelog page is available only in English language. + + + + License not found. + + + + Changelog not found. + + + + <b>%8</b><br><b>Version:</b> %1 (build on %2 with CMake %3)<br><b>Revision:</b> %4<br><b>Build date:</b> %5<br><b>Qt:</b> %6 (compiled against %7)<br> + + + + <body>Authors and contributors:<ul><li>Martin Rotter (<a href="mailto://rotter.martinos@gmail.com">rotter.martinos@gmail.com</a>) (author of RSS Guard)</li><li>snakebite & tiheum (authors of KFaenza/Faenza icon theme)</li><li>Digia Plc (author of QtSingleApplication component)</li></ul></body> + + + + <body>RSS Guard is a (very) tiny feed reader.<br><br>This software is distributed under the terms of GNU General Public License, version 3 or later.<br><br>Contacts:<ul><li><a href="mailto://rotter.martinos@gmail.com">rotter.martinos@gmail</a> ~email</li><li><a href="http://www.rssguard.sf.net">www.rssguard.sf.net</a> ~website</li></ul>You can obtain source code for Qonverter from its website.<br><br><br>Copyright © 2011-%1 Martin Rotter</body> + + + FormMain @@ -43,13 +149,45 @@ &Settings + + Tab 1 + + + + Tab 2 + + + + Ctrl+Shift+I + + + + Ctrl+Shift+E + + + + Ctrl+Shift+Q + + + + Ctrl+Shift+S + + + + &About RSS Guard + + + + &Fullscreen mode + + + + Ctrl+Shift+F + + FormSettings - - Dialog - - General @@ -66,6 +204,201 @@ system icon theme (default) + + Settings + + + + Keyboard shortcuts + + + + Language + + + + Proxy + + + + Launch RSS Guard on operating system startup + + + + Icons && skins + + + + Skin + + + + Notifications + + + + Tray icon + + + + disable + + + + enable + + + + When main window is closed, then + + + + hide it. + + + + quit the application. + + + + Start application hidden + + + + Web browser + + + + Color of website loading progress bar + + + + &Change... + + + + Use custom color for web browser progress bar + + + + Miscellaneous + + + + Type + + + + Host + + + + Hostname or IP of your proxy server + + + + Port + + + + Username + + + + Your username for proxy server authentication + + + + Password + + + + Your password for proxy server authentication + + + + Display password + + + + Password is stored in plain string in RSS Guard configuration file. + + + + Code + + + + Version + + + + Author + + + + Email + + + + Select color for web browser progress bar + + + + No proxy + + + + Socks5 + + + + Http + + + + Language of Qonverter was changed. Note that changes will take effect on next Qonverter start. + + + + Do you want to restart now? + + + + Language changed + + + + Problem with RSS Guard restart + + + + Qonverter couldn't be restarted, please restart it manually for changes to take effect. + + + + (not supported on this platform) + + + + disable (Tray icon is not available.) + + + + + FormWelcome + + Welcome + + + + Welcome to RSS Guard + + + + <html><head/><body><p>RSS Guard is a (very) easy feed reader. It supports all major feed formats, including RSS, ATOM and RDF.</p><p>Make sure you explore all available features. If you find a bug or if you want to propose new feature, then create new <a href="https://sourceforge.net/p/rssguard/tickets"><span style=" text-decoration: underline; color:#0000ff;">issue report</span></a>.</p><p>RSS Guard can be translated to any language. Contact its <a href="mailto:rotter.martinos@gmail.com"><span style=" text-decoration: underline; color:#0000ff;">author</span></a> in case of your interest.</p><p><br/></p></body></html> + + QObject @@ -95,4 +428,50 @@ rotter.martinos@gmail.com + + TrayIconMenu + + Close opened modal dialogs first. + + + + + WebBrowser + + Navigation panel + + + + Back + + + + Go back + + + + Forward + + + + Go forward + + + + Reload + + + + Reload current web page + + + + Stop + + + + Stop web page loading + + + diff --git a/src/core/localization.cpp b/src/core/localization.cpp index d5879e963..9e8b7eb49 100644 --- a/src/core/localization.cpp +++ b/src/core/localization.cpp @@ -33,33 +33,3 @@ QList Localization::getInstalledLanguages() { } return languages; } - -void Localization::load() { - // Obtain all needed data. - QString locale_name = Settings::getInstance()->value(APP_CFG_GEN, - "language", - "en").toString(); - QTranslator qt_translator, app_translator; - - // Load localizations. - if (app_translator.load(QString("rssguard_%1.qm").arg(locale_name), - APP_LANG_PATH)) { - qDebug("Application localization %s loaded successfully. Setting up locale.", - qPrintable(locale_name)); - } - else { - qDebug("Application localization %s was not loaded.", qPrintable(locale_name)); - } - - if (qt_translator.load(QString("qt_%1.qm").arg(locale_name), - APP_LANG_PATH)) { - qDebug("Qt localization %s loaded successfully. Setting up locale.", - qPrintable(locale_name)); - } - else { - qDebug("Qt localization %s was not loaded.", qPrintable(locale_name)); - } - - // Setup locale. - QLocale::setDefault(QLocale(locale_name)); -} diff --git a/src/core/localization.h b/src/core/localization.h index 5c674183e..8975bba1b 100644 --- a/src/core/localization.h +++ b/src/core/localization.h @@ -1,6 +1,32 @@ #ifndef LOCALIZATION_H #define LOCALIZATION_H +// Loads currently active language. +// NOTE: Macro is used due to QTranslator persistency. +#define LoadLocalization(); \ + QString locale_name = Settings::getInstance()->value(APP_CFG_GEN, \ + "language", \ + "en").toString(); \ + QTranslator qt_translator, app_translator; \ + if (app_translator.load(QString("rssguard_%1.qm").arg(locale_name), \ + APP_LANG_PATH)) { \ + QApplication::installTranslator(&app_translator); \ + qDebug("Application localization %s loaded successfully. Setting up locale.", \ + qPrintable(locale_name)); \ + } \ + else { \ + qDebug("Application localization %s was not loaded.", qPrintable(locale_name)); \ + } \ + if (qt_translator.load(QString("qt_%1.qm").arg(locale_name), \ + APP_LANG_PATH)) { \ + qDebug("Qt localization %s loaded successfully. Setting up locale.", \ + qPrintable(locale_name)); \ + } \ + else { \ + qDebug("Qt localization %s was not loaded.", qPrintable(locale_name)); \ + } \ + QLocale::setDefault(QLocale(locale_name)); + #include @@ -17,8 +43,6 @@ class Localization { Localization(); public: - // Sets up localization strings and locale from application settings. - static void load(); // Returns list of installed application localizations. // This list is used ie. in settings dialog. diff --git a/src/main.cpp b/src/main.cpp index 5ef06bfd2..ddf2fbde6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,6 +3,8 @@ #include #endif +#include + #include "core/defs.h" #include "core/debugging.h" #include "core/localization.h" @@ -64,7 +66,7 @@ int main(int argc, char *argv[]) { ThemeFactory::setupSearchPaths(); // Load localization and setup locale before any widget is constructed. - Localization::load(); + LoadLocalization(); // These settings needs to be set before any QSettings object. QtSingleApplication::setApplicationName(APP_NAME);