- Extended internationalization support in Web UI to the Javascript scripts

This commit is contained in:
Christophe Dumez 2009-11-23 13:11:09 +00:00
parent b1bbbd79c4
commit 74f0737903
32 changed files with 131 additions and 6 deletions

View file

@ -34,6 +34,7 @@
- FEATURE: Support for bitcomet padding files (libtorrent >= v0.15 only)
- FEATURE: Option to skip file checking and start seeding immediately in torrent addition dialog (Stephanos Antaris) (libtorrent >= v0.15 only)
- WEB UI: Removed Web UI to match new qBittorrent UI
- WEB UI: Added internationalization support
- COSMETIC: Merged download / upload lists
- COSMETIC: Torrents can be filtered based on their status
- COSMETIC: Torrent properties are now displayed in main window

View file

@ -102,12 +102,12 @@ void HttpConnection::write()
}
QString HttpConnection::translateDocument(QString data) {
std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer"};
std::string contexts[] = {"TransferListFiltersWidget", "TransferListWidget", "PropertiesWidget", "GUI", "MainWindow", "HttpServer", "confirmDeletionDlg"};
int i=0;
bool found = false;
do {
found = false;
QRegExp regex("_\\(([\\w\\s]+)\\)");
QRegExp regex("_\\(([\\w\\s?!]+)\\)");
i = regex.indexIn(data, i);
if(i >= 0) {
qDebug("Found translatable string: %s", regex.cap(1).toUtf8().data());
@ -117,7 +117,7 @@ QString HttpConnection::translateDocument(QString data) {
do {
translation = qApp->translate(contexts[context_index].c_str(), word.toLocal8Bit().data(), 0, QCoreApplication::UnicodeUTF8, 1);
++context_index;
}while(translation == word && context_index < 6);
}while(translation == word && context_index < 7);
qDebug("Translation is %s", translation.toUtf8().data());
data = data.replace(i, regex.matchedLength(), translation);
i += translation.length();
@ -185,7 +185,7 @@ void HttpConnection::respond()
ext.clear();
QByteArray data = file.readAll();
// Translate the page
if(ext == "html") {
if(ext == "html" || ext == "js") {
data = translateDocument(QString::fromUtf8(data.data())).toUtf8();
}
generator.setStatusLine(200, "OK");

View file

@ -67,6 +67,7 @@ HttpServer::HttpServer(Bittorrent *_BTSession, int msec, QObject* parent) : QTcp
a = tr("Torrent files were correctly added to download list.");
a = tr("Point to torrent file");
a = tr("Download");
a = tr("Are you sure you want to delete the selected torrents from the transfer list and hard disk?");
}
HttpServer::~HttpServer()

View file

@ -2839,6 +2839,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Свали</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2315,6 +2315,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Descàrrega</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -1904,6 +1904,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Stáhnout</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2042,6 +2042,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2806,6 +2806,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Lade</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2908,6 +2908,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Κατέβασμα</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -1357,6 +1357,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2749,6 +2749,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Descargar</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2489,6 +2489,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Lataa</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

Binary file not shown.

View file

@ -2984,6 +2984,11 @@ Etes-vous certain de vouloir quitter qBittorrent ?</translation>
<source>Download</source>
<translation>Télécharger</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation>Etes-vous certain de vouloir supprimer les torrents sélectionnés de la liste et du disque dur ?</translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2334,6 +2334,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Letöltés</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2661,6 +2661,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Download</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2264,6 +2264,11 @@ qBittorrent を終了してもよろしいですか?</translation>
<source>Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2831,6 +2831,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2244,6 +2244,11 @@ Are you sure you want to quit qBittorrent?</source>
<source>Download</source>
<translation type="unfinished">Last ned</translation>
</message>
<message>
<location filename="../httpserver.cpp" line="70"/>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2504,6 +2504,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2526,6 +2526,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2433,6 +2433,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2433,6 +2433,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2360,6 +2360,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2521,6 +2521,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2446,6 +2446,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -1495,6 +1495,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2506,6 +2506,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2380,6 +2380,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -2641,6 +2641,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -1590,6 +1590,10 @@ Are you sure you want to quit qBittorrent?</source>
<source>Point to torrent file</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Are you sure you want to delete the selected torrents from the transfer list and hard disk?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>

View file

@ -64,7 +64,7 @@ initializeWindows = function(){
addClickEvent('delete', function(e){
new Event(e).stop();
var h = myTable.selectedIds();
if(h.length && confirm('Are you sure you want to delete the selected item in download list?')) {
if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list?)')) {
h.each(function(item, index){
new Request({url: '/command/delete', method: 'post', data: {hash: item}}).send();
});
@ -76,7 +76,7 @@ initializeWindows = function(){
addClickEvent('deletePerm', function(e){
new Event(e).stop();
var h = myTable.selectedIds();
if(h.length && confirm('Are you sure you want to delete from hard drive the selected item in download list?')) {
if(h.length && confirm('_(Are you sure you want to delete the selected torrents from the transfer list and hard disk?)')) {
h.each(function(item, index){
new Request({url: '/command/deletePerm', method: 'post', data: {hash: item}}).send();
});