diff --git a/.gitignore b/.gitignore index b59cfad20..e8353ccca 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ CMakeLists.txt.user* target/ libs/ +*.orig /build /build2 diff --git a/CMakeLists.txt b/CMakeLists.txt index d7aa9fb59..1f34fe2ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ OPTION(CPACK_SUPPORT "Enable package support" ON) OPTION(DEVELOPER_DYNAMIC_RUNTIME "Build with dynamic C++ runtime" ON) OPTION(DEVELOPER_FEATURES "Use some debug tricks for developers" OFF) OPTION(DEVELOPER_ENABLE_TESTS "Enable tests for ${PROJECT_NAME_TITLE} project" ON) +OPTION(UPDATE_TRANSLATIONS "Update translations (*.ts files)" OFF) IF(MSVC) IF(CMAKE_CL_64) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca460d434..afe54ebcf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,6 +9,8 @@ SET(PCRE_BUILD_TESTS OFF CACHE BOOL "Build the tests pcre tests.") SET(PCRE_BUILD_PCREGREP OFF CACHE BOOL "Build pcregrep") ADD_SUBDIRECTORY(third-party/mongodb/src/third_party/pcre-8.30 pcrecpp) +ADD_SUBDIRECTORY(robomongo/lang lang) + SET(HEADERS_GUI_TO_MOC robomongo/gui/dialogs/ConnectionsDialog.h robomongo/gui/dialogs/ConnectionDialog.h @@ -442,6 +444,7 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${TARGET_INSTALL_DESTINATION} COMPON INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION . COMPONENT LICENSE) INSTALL(FILES ${CMAKE_SOURCE_DIR}/COPYRIGHT DESTINATION . COMPONENT LICENSE) INSTALL(FILES ${CMAKE_SOURCE_DIR}/whats-new.txt DESTINATION . COMPONENT LICENSE RENAME CHANGELOG) +INSTALL(FILES ${QM_FILES} DESTINATION ${LIB_INSTALL_DESTINATION}/translations) INSTALL_QT(${PROJECT_NAME} ${LIB_INSTALL_DESTINATION}) IF(WIN32) diff --git a/src/robomongo/app/main.cpp b/src/robomongo/app/main.cpp index 69ca42cd0..10b87741f 100644 --- a/src/robomongo/app/main.cpp +++ b/src/robomongo/app/main.cpp @@ -1,17 +1,23 @@ #include #include +#include #include #include "robomongo/gui/MainWindow.h" #include "robomongo/gui/AppStyle.h" +#include "robomongo/core/AppRegistry.h" +#include "robomongo/core/settings/SettingsManager.h" +#include "robomongo/core/utils/Logger.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); - Robomongo::detail::initStyle(); - setlocale(LC_NUMERIC,"C"); // do not move this line!!! - + Robomongo::detail::initStyle(); + setlocale(LC_NUMERIC, "C"); // do not move this line!!! + + Robomongo::AppRegistry::instance().settingsManager()->switchTranslator(Robomongo::AppRegistry::instance().settingsManager()->currentTranslation(), true); + QRect screenGeometry = QApplication::desktop()->availableGeometry(); QSize size(screenGeometry.width() - 450, screenGeometry.height() - 165); diff --git a/src/robomongo/core/AppRegistry.h b/src/robomongo/core/AppRegistry.h index 745d0752f..72ebe66d7 100644 --- a/src/robomongo/core/AppRegistry.h +++ b/src/robomongo/core/AppRegistry.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "robomongo/core/Core.h" #include "robomongo/core/utils/SingletonPattern.hpp" @@ -15,7 +17,7 @@ namespace Robomongo SettingsManager *const settingsManager() const { return _settingsManager.get(); } App *const app() const { return _app.get(); } EventBus *const bus() const { return _bus.get(); } - + private: AppRegistry(); ~AppRegistry(); diff --git a/src/robomongo/core/domain/Notifier.cpp b/src/robomongo/core/domain/Notifier.cpp index c83081f4b..829f8fe8f 100644 --- a/src/robomongo/core/domain/Notifier.cpp +++ b/src/robomongo/core/domain/Notifier.cpp @@ -72,25 +72,25 @@ namespace Robomongo QWidget *wid = dynamic_cast(_observer); AppRegistry::instance().bus()->subscribe(this, InsertDocumentResponse::Type); - _deleteDocumentAction = new QAction("Delete Document...", wid); + _deleteDocumentAction = new QAction(tr("Delete Document..."), wid); VERIFY(connect(_deleteDocumentAction, SIGNAL(triggered()), SLOT(onDeleteDocument()))); - _deleteDocumentsAction = new QAction("Delete Documents...", wid); + _deleteDocumentsAction = new QAction(tr("Delete Documents..."), wid); VERIFY(connect(_deleteDocumentsAction, SIGNAL(triggered()), SLOT(onDeleteDocuments()))); - _editDocumentAction = new QAction("Edit Document...", wid); + _editDocumentAction = new QAction(tr("Edit Document..."), wid); VERIFY(connect(_editDocumentAction, SIGNAL(triggered()), SLOT(onEditDocument()))); - _viewDocumentAction = new QAction("View Document...", wid); + _viewDocumentAction = new QAction(tr("View Document..."), wid); VERIFY(connect(_viewDocumentAction, SIGNAL(triggered()), SLOT(onViewDocument()))); - _insertDocumentAction = new QAction("Insert Document...", wid); + _insertDocumentAction = new QAction(tr("Insert Document..."), wid); VERIFY(connect(_insertDocumentAction, SIGNAL(triggered()), SLOT(onInsertDocument()))); - _copyValueAction = new QAction("Copy Value", wid); + _copyValueAction = new QAction(tr("Copy Value"), wid); VERIFY(connect(_copyValueAction, SIGNAL(triggered()), SLOT(onCopyDocument()))); - _copyJsonAction = new QAction("Copy JSON", wid); + _copyJsonAction = new QAction(tr("Copy JSON"), wid); VERIFY(connect(_copyJsonAction, SIGNAL(triggered()), SLOT(onCopyJson()))); } @@ -138,8 +138,8 @@ namespace Robomongo mongo::BSONElement id = obj.getField("_id"); if (id.eoo()) { - QMessageBox::warning(dynamic_cast(_observer), "Cannot delete", "Selected document doesn't have _id field. \n" - "Maybe this is a system document that should be managed in a special way?"); + QMessageBox::warning(dynamic_cast(_observer), tr("Cannot delete"), tr("Selected document doesn't have _id field. \n" + "Maybe this is a system document that should be managed in a special way?")); break; } @@ -150,8 +150,8 @@ namespace Robomongo if (!force) { // Ask user - int answer = utils::questionDialog(dynamic_cast(_observer), "Delete", - "Document", "%1 %2 with id:
%3?", QtUtils::toQString(id.toString(false))); + int answer = utils::questionDialog(dynamic_cast(_observer), tr("Delete"), + tr("Document"), tr("%1 %2 with id:
%3?"), QtUtils::toQString(id.toString(false))); if (answer != QMessageBox::Yes) break; @@ -178,7 +178,7 @@ namespace Robomongo QModelIndexList selectedIndexes = _observer->selectedIndexes(); if (!detail::isMultySelection(selectedIndexes)) return; - int answer = QMessageBox::question(dynamic_cast(_observer), "Delete", QString("Do you want to delete %1 selected documents?").arg(selectedIndexes.count())); + int answer = QMessageBox::question(dynamic_cast(_observer), tr("Delete"), tr("Do you want to delete %n selected documents?", "", selectedIndexes.count())); if (answer == QMessageBox::Yes) { std::vector items; for (QModelIndexList::const_iterator it = selectedIndexes.begin(); it!= selectedIndexes.end(); ++it) { @@ -228,7 +228,7 @@ namespace Robomongo DocumentTextEditor editor(_queryInfo._info, json, false, dynamic_cast(_observer)); - editor.setWindowTitle("Edit Document"); + editor.setWindowTitle(tr("Edit Document")); int result = editor.exec(); if (result == QDialog::Accepted) { @@ -257,7 +257,7 @@ namespace Robomongo DocumentTextEditor *editor = new DocumentTextEditor(_queryInfo._info, json, true, dynamic_cast(_observer)); - editor->setWindowTitle("View Document"); + editor->setWindowTitle(tr("View Document")); editor->show(); } @@ -270,7 +270,7 @@ namespace Robomongo "{\n \n}", false, dynamic_cast(_observer)); editor.setCursorPosition(1, 4); - editor.setWindowTitle("Insert Document"); + editor.setWindowTitle(tr("Insert Document")); int result = editor.exec(); if (result != QDialog::Accepted) diff --git a/src/robomongo/core/domain/ScriptInfo.cpp b/src/robomongo/core/domain/ScriptInfo.cpp index e56891e60..439d2b184 100644 --- a/src/robomongo/core/domain/ScriptInfo.cpp +++ b/src/robomongo/core/domain/ScriptInfo.cpp @@ -7,8 +7,7 @@ namespace { - const QString filterForScripts = QObject::tr("JavaScript (*.js);; All Files (*.*)"); - + bool loadFromFileText(const QString &filePath, QString &text) { bool result = false; @@ -21,8 +20,8 @@ namespace result = true; } else { - QMessageBox::critical(QApplication::activeWindow(), QString("Error"), - QObject::tr(PROJECT_NAME" can't read from %1:\n%2.") + QMessageBox::critical(QApplication::activeWindow(), qApp->translate("loadFromFileText", "Error"), + PROJECT_NAME + qApp->translate("loadFromFileText", " can't read from %1:\n%2.") .arg(filePath) .arg(file.errorString())); } @@ -50,8 +49,8 @@ namespace result = true; } else { - QMessageBox::critical(QApplication::activeWindow(), QString("Error"), - QObject::tr(PROJECT_NAME" can't save to %1:\n%2.") + QMessageBox::critical(QApplication::activeWindow(), qApp->translate("saveToFileText", "Error"), + PROJECT_NAME + qApp->translate("saveToFileText", " can't save to %1:\n%2.") .arg(filePath) .arg(file.errorString())); } @@ -62,13 +61,17 @@ namespace namespace Robomongo { + QString filterForScripts; + ScriptInfo::ScriptInfo(const QString &script, bool execute,const CursorPosition &position, const QString &title, const QString &filePath) : _script(script), _execute(execute), _title(title), _cursor(position), - _filePath(filePath) {} + _filePath(filePath) { + filterForScripts = qApp->translate("Robomongo::ScriptInfo", "JavaScript (*.js);; All Files (*.*)"); + } bool ScriptInfo::loadFromFile(const QString &filePath) { @@ -93,7 +96,7 @@ namespace Robomongo bool ScriptInfo::saveToFileAs() { QString filepath = QFileDialog::getSaveFileName(QApplication::activeWindow(), - QObject::tr("Save As"), _filePath, filterForScripts); + qApp->translate("Robomongo::ScriptInfo", "Save As"), _filePath, filterForScripts); if (saveToFileText(filepath,_script)) { _filePath = filepath; diff --git a/src/robomongo/core/mongodb/MongoClient.cpp b/src/robomongo/core/mongodb/MongoClient.cpp index c8e1e918a..fe5bd2b95 100644 --- a/src/robomongo/core/mongodb/MongoClient.cpp +++ b/src/robomongo/core/mongodb/MongoClient.cpp @@ -415,7 +415,7 @@ namespace Robomongo //_dbclient->save(ns.toString().toStdString(), obj); } - void MongoClient::removeDocuments(const MongoNamespace &ns, mongo::Query query, bool justOne /*= true*/) + void MongoClient::removeDocuments(const MongoNamespace &ns, mongo::Query query, bool justOne /* = true */) { _dbclient->remove(ns.toString(), query, justOne); } diff --git a/src/robomongo/core/mongodb/MongoWorker.cpp b/src/robomongo/core/mongodb/MongoWorker.cpp index a51ddc1c8..930c6025a 100644 --- a/src/robomongo/core/mongodb/MongoWorker.cpp +++ b/src/robomongo/core/mongodb/MongoWorker.cpp @@ -108,7 +108,7 @@ namespace Robomongo _connection->primaryCredential()->userPassword(), errmsg); if (!ok) { - throw std::runtime_error("Unable to authorize"); + throw std::runtime_error(tr("Unable to authorize").toStdString()); } // If authentication succeed and database name is 'admin' - @@ -123,7 +123,7 @@ namespace Robomongo std::vector dbNames = getDatabaseNamesSafe(); reply(event->sender(), new EstablishConnectionResponse(this, ConnectionInfo(_connection->getFullAddress(), dbNames, client->getVersion()) )); } catch(const std::exception &ex) { - reply(event->sender(), new EstablishConnectionResponse(this, EventError("Unable to connect to MongoDB"))); + reply(event->sender(), new EstablishConnectionResponse(this, EventError(tr("Unable to connect to MongoDB").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -171,7 +171,7 @@ namespace Robomongo if(dbNames.size()){ reply(event->sender(), new LoadDatabaseNamesResponse(this, dbNames)); }else{ - reply(event->sender(), new LoadDatabaseNamesResponse(this, EventError("Unable to load database names."))); + reply(event->sender(), new LoadDatabaseNamesResponse(this, EventError(tr("Unable to load database names.").toStdString()))); } } @@ -189,7 +189,7 @@ namespace Robomongo reply(event->sender(), new LoadCollectionNamesResponse(this, event->databaseName(), infos)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new LoadCollectionNamesResponse(this, EventError("Unable to load list of collections."))); + reply(event->sender(), new LoadCollectionNamesResponse(this, EventError(tr("Unable to load list of collections.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -203,7 +203,7 @@ namespace Robomongo reply(event->sender(), new LoadUsersResponse(this, event->databaseName(), users)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new LoadUsersResponse(this, EventError("Unable to load list of users."))); + reply(event->sender(), new LoadUsersResponse(this, EventError(tr("Unable to load list of users.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -276,7 +276,7 @@ namespace Robomongo reply(event->sender(), new LoadFunctionsResponse(this, event->databaseName(), funs)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new LoadFunctionsResponse(this, EventError("Unable to load list of functions."))); + reply(event->sender(), new LoadFunctionsResponse(this, EventError(tr("Unable to load list of functions.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -295,7 +295,7 @@ namespace Robomongo reply(event->sender(), new InsertDocumentResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new InsertDocumentResponse(this, EventError("Unable to insert document."))); + reply(event->sender(), new InsertDocumentResponse(this, EventError(tr("Unable to insert document.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -310,7 +310,7 @@ namespace Robomongo reply(event->sender(), new RemoveDocumentResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new RemoveDocumentResponse(this, EventError("Unable to remove documents."))); + reply(event->sender(), new RemoveDocumentResponse(this, EventError(tr("Unable to remove documents.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -324,7 +324,7 @@ namespace Robomongo reply(event->sender(), new ExecuteQueryResponse(this, event->resultIndex(), event->queryInfo(), docs)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new ExecuteQueryResponse(this, EventError("Unable to complete query."))); + reply(event->sender(), new ExecuteQueryResponse(this, EventError(tr("Unable to complete query.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -338,7 +338,7 @@ namespace Robomongo MongoShellExecResult result = _scriptEngine->exec(event->script, event->databaseName); reply(event->sender(), new ExecuteScriptResponse(this, result, event->script.empty())); } catch(const mongo::DBException &ex) { - reply(event->sender(), new ExecuteScriptResponse(this, EventError("Unable to complete query."))); + reply(event->sender(), new ExecuteScriptResponse(this, EventError(tr("Unable to complete query.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -349,7 +349,7 @@ namespace Robomongo QStringList list = _scriptEngine->complete(event->prefix); reply(event->sender(), new AutocompleteResponse(this, list, event->prefix)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new ExecuteScriptResponse(this, EventError("Unable to autocomplete query."))); + reply(event->sender(), new ExecuteScriptResponse(this, EventError(tr("Unable to autocomplete query.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -363,7 +363,7 @@ namespace Robomongo reply(event->sender(), new CreateDatabaseResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new CreateDatabaseResponse(this, EventError("Unable to create database."))); + reply(event->sender(), new CreateDatabaseResponse(this, EventError(tr("Unable to create database.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -377,7 +377,7 @@ namespace Robomongo reply(event->sender(), new DropDatabaseResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new DropDatabaseResponse(this, EventError("Unable to drop database."))); + reply(event->sender(), new DropDatabaseResponse(this, EventError(tr("Unable to drop database.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -391,7 +391,7 @@ namespace Robomongo reply(event->sender(), new CreateCollectionResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new CreateCollectionResponse(this, EventError("Unable to create collection."))); + reply(event->sender(), new CreateCollectionResponse(this, EventError(tr("Unable to create collection.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -405,7 +405,7 @@ namespace Robomongo reply(event->sender(), new DropCollectionResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new DropCollectionResponse(this, EventError("Unable to drop collection."))); + reply(event->sender(), new DropCollectionResponse(this, EventError(tr("Unable to drop collection.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -419,7 +419,7 @@ namespace Robomongo reply(event->sender(), new RenameCollectionResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new RenameCollectionResponse(this, EventError("Unable to rename collection."))); + reply(event->sender(), new RenameCollectionResponse(this, EventError(tr("Unable to rename collection.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -433,7 +433,7 @@ namespace Robomongo reply(event->sender(), new DuplicateCollectionResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new DuplicateCollectionResponse(this, EventError("Unable to duplicate collection."))); + reply(event->sender(), new DuplicateCollectionResponse(this, EventError(tr("Unable to duplicate collection.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -448,7 +448,7 @@ namespace Robomongo reply(event->sender(), new CopyCollectionToDiffServerResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new CopyCollectionToDiffServerResponse(this, EventError("Unable to copy collection."))); + reply(event->sender(), new CopyCollectionToDiffServerResponse(this, EventError(tr("Unable to copy collection.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -462,7 +462,7 @@ namespace Robomongo reply(event->sender(), new CreateUserResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new CreateUserResponse(this, EventError("Unable to create/ovewrite user."))); + reply(event->sender(), new CreateUserResponse(this, EventError(tr("Unable to create/ovewrite user.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -476,7 +476,7 @@ namespace Robomongo reply(event->sender(), new DropUserResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new DropUserResponse(this, EventError("Unable to drop user."))); + reply(event->sender(), new DropUserResponse(this, EventError(tr("Unable to drop user.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -490,7 +490,7 @@ namespace Robomongo reply(event->sender(), new CreateFunctionResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new CreateFunctionResponse(this, EventError("Unable to create/ovewrite function."))); + reply(event->sender(), new CreateFunctionResponse(this, EventError(tr("Unable to create/ovewrite function.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } @@ -504,7 +504,7 @@ namespace Robomongo reply(event->sender(), new DropFunctionResponse(this)); } catch(const mongo::DBException &ex) { - reply(event->sender(), new DropFunctionResponse(this, EventError("Unable to drop function."))); + reply(event->sender(), new DropFunctionResponse(this, EventError(tr("Unable to drop function.").toStdString()))); LOG_MSG(ex.what(), mongo::LL_ERROR); } } diff --git a/src/robomongo/core/settings/SettingsManager.cpp b/src/robomongo/core/settings/SettingsManager.cpp index 8e2251277..bec9216bb 100644 --- a/src/robomongo/core/settings/SettingsManager.cpp +++ b/src/robomongo/core/settings/SettingsManager.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -10,48 +11,52 @@ #include "robomongo/core/utils/Logger.h" #include "robomongo/core/utils/StdUtils.h" #include "robomongo/gui/AppStyle.h" +#include "robomongo/core/AppRegistry.h" namespace { - /** - * @brief Version of schema - */ - const QString SchemaVersion = "1.0"; - - /** - * @brief Config file absolute path - * (usually: /home/user/.config/robomongo/robomongo.json) - */ - const QString _configPath = QString("%1/.config/"PROJECT_NAME_LOWERCASE"/"PROJECT_NAME_LOWERCASE".json").arg(QDir::homePath()); - - /** - * @brief Config file containing directory path - * (usually: /home/user/.config/robomongo) - */ - const QString _configDir = QString("%1/.config/"PROJECT_NAME_LOWERCASE).arg(QDir::homePath()); + /** + * @brief Version of schema + */ + const QString SchemaVersion = "1.0"; + + /** + * @brief Config file absolute path + * (usually: /home/user/.config/robomongo/robomongo.json) + */ + const QString _configPath = QString("%1/.config/"PROJECT_NAME_LOWERCASE"/"PROJECT_NAME_LOWERCASE".json").arg(QDir::homePath()); + + /** + * @brief Config file containing directory path + * (usually: /home/user/.config/robomongo) + */ + const QString _configDir = QString("%1/.config/"PROJECT_NAME_LOWERCASE).arg(QDir::homePath()); } namespace Robomongo { + /** * Creates SettingsManager for config file in default location * ~/.config/robomongo/robomongo.json */ SettingsManager::SettingsManager() : - _version(SchemaVersion), - _uuidEncoding(DefaultEncoding), - _timeZone(Utc), - _viewMode(Robomongo::Tree), - _batchSize(50), - _disableConnectionShortcuts(false) + _version(SchemaVersion), + _uuidEncoding(DefaultEncoding), + _timeZone(Utc), + _viewMode(Robomongo::Tree), + _batchSize(50), + _disableConnectionShortcuts(false) { load(); + _qmPath = QCoreApplication::applicationDirPath() + "/../lib/translations"; + loadProvidedTranslations(); LOG_MSG("SettingsManager initialized in " + _configPath, mongo::LL_INFO, false); } SettingsManager::~SettingsManager() { - std::for_each(_connections.begin(),_connections.end(),stdutils::default_delete()); + std::for_each(_connections.begin(), _connections.end(), stdutils::default_delete()); } /** @@ -130,7 +135,7 @@ namespace Robomongo } _autoExpand = map.contains("autoExpand") ? - map.value("autoExpand").toBool() : true; + map.value("autoExpand").toBool() : true; _lineNumbers = map.contains("lineNumbers") ? map.value("lineNumbers").toBool() : true; @@ -161,6 +166,8 @@ namespace Robomongo ConnectionSettings *record = new ConnectionSettings((*it).toMap()); _connections.push_back(record); } + + _currentTranslation = map.value("translation").toString(); } /** @@ -189,7 +196,7 @@ namespace Robomongo // 6. Save disableConnectionShortcuts map.insert("disableConnectionShortcuts", _disableConnectionShortcuts); - + // 7. Save batchSize map.insert("batchSize", _batchSize); @@ -199,13 +206,16 @@ namespace Robomongo // 9. Save connections QVariantList list; - for (ConnectionSettingsContainerType::const_iterator it = _connections.begin(); it!=_connections.end(); ++it) { + for (ConnectionSettingsContainerType::const_iterator it = _connections.begin(); it != _connections.end(); ++it) { QVariantMap rm = (*it)->toVariant().toMap(); list.append(rm); } map.insert("connections", list); + //10. Save translsation + map.insert("translation", _currentTranslation); + return map; } @@ -222,8 +232,8 @@ namespace Robomongo */ void SettingsManager::removeConnection(ConnectionSettings *connection) { - ConnectionSettingsContainerType::iterator it = std::find(_connections.begin(),_connections.end(),connection); - if (it!=_connections.end()) { + ConnectionSettingsContainerType::iterator it = std::find(_connections.begin(), _connections.end(), connection); + if (it != _connections.end()) { _connections.erase(it); delete connection; } @@ -239,4 +249,54 @@ namespace Robomongo _connections = connections; } + void SettingsManager::setCurrentTranslation(const QString& translation) + { + _currentTranslation = _translations.contains(translation) == true ? translation : ""; + } + + void SettingsManager::loadProvidedTranslations() + { + QDirIterator qmIt(_qmPath, QStringList() << PROJECT_NAME_LOWERCASE"_*.qm", QDir::Files); + _translations[""] = "locale"; + QFileInfo finfo; + QTranslator translator; + while (qmIt.hasNext()) { + qmIt.next(); + finfo = qmIt.fileInfo(); + translator.load(finfo.baseName(), _qmPath); + //: Native language name: "English" for English, "Русский" for Russian etc. + QT_TRANSLATE_NOOP("Robomongo::SettingsManager", "__LANGUAGE_NAME__"); + _translations[finfo.baseName()] = translator.translate("Robomongo::SettingsManager", "__LANGUAGE_NAME__"); + } + } + + void SettingsManager::switchTranslator(const QString& translation, bool forced) + { + if (forced == true || translation != _currentTranslation) { + QTranslator *tr = new QTranslator(); + QTranslator *trQt = new QTranslator(); + QString basename = translation.isEmpty() ? PROJECT_NAME_LOWERCASE"_" + QLocale::system().name() : translation; + qApp->removeTranslator(_translator); + delete _translator; + _translator = NULL; + if (tr->load(basename + ".qm", _qmPath)) { + _translator = tr; + qApp->installTranslator(_translator); + } + qApp->removeTranslator(_translatorQt); + delete _translatorQt; + _translatorQt = NULL; + if (trQt->load(basename.replace(PROJECT_NAME_LOWERCASE, "qt") + ".qm", _qmPath)) { + _translatorQt = trQt; + qApp->installTranslator(_translatorQt); + } + if (!forced) { + setCurrentTranslation(translation); + save(); + /** @TODO REMOVE */ + LOG_MSG("Translation switched to " + _currentTranslation, mongo::LL_INFO, false); + } + } + } + } diff --git a/src/robomongo/core/settings/SettingsManager.h b/src/robomongo/core/settings/SettingsManager.h index ccceafaaa..ca43f587c 100644 --- a/src/robomongo/core/settings/SettingsManager.h +++ b/src/robomongo/core/settings/SettingsManager.h @@ -1,9 +1,14 @@ #pragma once +#include #include #include +#include +#include #include +#include #include "robomongo/core/Enums.h" +#include "robomongo/core/utils/QtUtils.h" namespace Robomongo { @@ -89,7 +94,11 @@ namespace Robomongo QString currentStyle() const {return _currentStyle; } void setCurrentStyle(const QString& style); - + + QString currentTranslation() const {return _currentTranslation; } + void setCurrentTranslation(const QString& langName); + QMap getTranslations() const {return _translations; } + void switchTranslator(const QString& langName, bool forced = false); private: @@ -123,6 +132,13 @@ namespace Robomongo bool _disableConnectionShortcuts; int _batchSize; QString _currentStyle; + + QTranslator *_translator; + QTranslator *_translatorQt; + QString _currentTranslation; + QString _qmPath; + QMap _translations; + void loadProvidedTranslations(); /** * @brief List of connections */ diff --git a/src/robomongo/gui/AppStyle.cpp b/src/robomongo/gui/AppStyle.cpp index 6814ad0a7..bbc3d69ea 100644 --- a/src/robomongo/gui/AppStyle.cpp +++ b/src/robomongo/gui/AppStyle.cpp @@ -52,7 +52,7 @@ namespace Robomongo return OsStyle::drawPrimitive(element, option, painter, widget); } - QRect AppStyle::subElementRect( SubElement element, const QStyleOption * option, const QWidget * widget /*= 0 */ ) const + QRect AppStyle::subElementRect( SubElement element, const QStyleOption * option, const QWidget * widget /* = 0 */ ) const { return OsStyle::subElementRect(element, option, widget); } diff --git a/src/robomongo/gui/MainWindow.cpp b/src/robomongo/gui/MainWindow.cpp index 96406f351..f22cf588f 100644 --- a/src/robomongo/gui/MainWindow.cpp +++ b/src/robomongo/gui/MainWindow.cpp @@ -96,11 +96,9 @@ namespace Robomongo AppRegistry::instance().bus()->subscribe(this, QueryWidgetUpdatedEvent::Type); QColor background = palette().window().color(); - QString controlKey = "Ctrl"; #if defined(Q_OS_MAC) QString explorerColor = "#DEE3EA"; // was #CED6DF" - controlKey = QChar(0x2318); // "Command" key aka Cauliflower #elif defined(Q_OS_LINUX) QString explorerColor = background.darker(103).name(); #else @@ -113,31 +111,29 @@ namespace Robomongo "QMainWindow::separator { background: #E7E5E4; width: 1px; } " ).arg(explorerColor)); - _openAction = new QAction(GuiRegistry::instance().openIcon(), tr("&Open..."), this); - _openAction->setToolTip("Load script from the file to the currently opened shell"); + _openAction = new QAction(this); + _openAction->setIcon(GuiRegistry::instance().openIcon()); _openAction->setShortcuts(QKeySequence::Open); VERIFY(connect(_openAction, SIGNAL(triggered()), this, SLOT(open()))); - _saveAction = new QAction(GuiRegistry::instance().saveIcon(), tr("&Save"), this); + _saveAction = new QAction(this); + _saveAction->setIcon(GuiRegistry::instance().saveIcon()); _saveAction->setShortcuts(QKeySequence::Save); - _saveAction->setToolTip(QString("Save script of the currently opened shell to the file (%1 + S)").arg(controlKey)); VERIFY(connect(_saveAction, SIGNAL(triggered()), this, SLOT(save()))); - _saveAsAction = new QAction(tr("Save &As..."), this); + _saveAsAction = new QAction(this); _saveAsAction->setShortcuts(QKeySequence::SaveAs); VERIFY(connect(_saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()))); // Exit action - QAction *exitAction = new QAction("&Exit", this); - exitAction->setShortcut(QKeySequence::Quit); - VERIFY(connect(exitAction, SIGNAL(triggered()), this, SLOT(close()))); + _exitAction = new QAction(this); + _exitAction->setShortcut(QKeySequence::Quit); + VERIFY(connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()))); // Connect action - _connectAction = new QAction("&Connect...", this); + _connectAction = new QAction(this); _connectAction->setShortcut(QKeySequence::New); _connectAction->setIcon(GuiRegistry::instance().connectIcon()); - _connectAction->setIconText("Connect"); - _connectAction->setToolTip(QString("Connect to local or remote MongoDB instance (%1 + O)").arg(controlKey)); VERIFY(connect(_connectAction, SIGNAL(triggered()), this, SLOT(manageConnections()))); _connectionsMenu = new ConnectionMenu(this); @@ -145,10 +141,8 @@ namespace Robomongo updateConnectionsMenu(); _connectButton = new QToolButton(); - _connectButton->setText("&Connect..."); _connectButton->setIcon(GuiRegistry::instance().connectIcon()); _connectButton->setFocusPolicy(Qt::NoFocus); - _connectButton->setToolTip(QString("Connect to local or remote MongoDB instance (%1 + O)").arg(controlKey)); _connectButton->setToolButtonStyle(Qt::ToolButtonIconOnly); #if !defined(Q_OS_MAC) @@ -162,57 +156,51 @@ namespace Robomongo connectButtonAction->setDefaultWidget(_connectButton); // Orientation action - _orientationAction = new QAction("&Rotate", this); + _orientationAction = new QAction(this); _orientationAction->setShortcut(Qt::Key_F10); _orientationAction->setIcon(GuiRegistry::instance().rotateIcon()); - _orientationAction->setToolTip("Toggle orientation of results view (F10)"); VERIFY(connect(_orientationAction, SIGNAL(triggered()), this, SLOT(toggleOrientation()))); // read view mode setting ViewMode viewMode = AppRegistry::instance().settingsManager()->viewMode(); // Text mode action - QAction *textModeAction = new QAction("&Text Mode", this); - textModeAction->setShortcut(Qt::Key_F4); - textModeAction->setIcon(GuiRegistry::instance().textHighlightedIcon()); - textModeAction->setToolTip("Show current tab in text mode, and make this mode default for all subsequent queries (F4)"); - textModeAction->setCheckable(true); - textModeAction->setChecked(viewMode == Text); - VERIFY(connect(textModeAction, SIGNAL(triggered()), this, SLOT(enterTextMode()))); + _textModeAction = new QAction(this); + _textModeAction->setShortcut(Qt::Key_F4); + _textModeAction->setIcon(GuiRegistry::instance().textHighlightedIcon()); + _textModeAction->setCheckable(true); + _textModeAction->setChecked(viewMode == Text); + VERIFY(connect(_textModeAction, SIGNAL(triggered()), this, SLOT(enterTextMode()))); // Tree mode action - QAction *treeModeAction = new QAction("&Tree Mode", this); - treeModeAction->setShortcut(Qt::Key_F2); - treeModeAction->setIcon(GuiRegistry::instance().treeHighlightedIcon()); - treeModeAction->setToolTip("Show current tab in tree mode, and make this mode default for all subsequent queries (F3)"); - treeModeAction->setCheckable(true); - treeModeAction->setChecked(viewMode == Tree); - VERIFY(connect(treeModeAction, SIGNAL(triggered()), this, SLOT(enterTreeMode()))); + _treeModeAction = new QAction(this); + _treeModeAction->setShortcut(Qt::Key_F2); + _treeModeAction->setIcon(GuiRegistry::instance().treeHighlightedIcon()); + _treeModeAction->setCheckable(true); + _treeModeAction->setChecked(viewMode == Tree); + VERIFY(connect(_treeModeAction, SIGNAL(triggered()), this, SLOT(enterTreeMode()))); // Tree mode action - QAction *tableModeAction = new QAction("T&able Mode", this); - tableModeAction->setShortcut(Qt::Key_F3); - tableModeAction->setIcon(GuiRegistry::instance().tableHighlightedIcon()); - tableModeAction->setToolTip("Show current tab in table mode, and make this mode default for all subsequent queries (F3)"); - tableModeAction->setCheckable(true); - tableModeAction->setChecked(viewMode == Table); - VERIFY(connect(tableModeAction, SIGNAL(triggered()), this, SLOT(enterTableMode()))); + _tableModeAction = new QAction(this); + _tableModeAction->setShortcut(Qt::Key_F3); + _tableModeAction->setIcon(GuiRegistry::instance().tableHighlightedIcon()); + _tableModeAction->setCheckable(true); + _tableModeAction->setChecked(viewMode == Table); + VERIFY(connect(_tableModeAction, SIGNAL(triggered()), this, SLOT(enterTableMode()))); // Custom mode action - QAction *customModeAction = new QAction("&Custom Mode", this); - //customModeAction->setShortcut(Qt::Key_F2); - customModeAction->setIcon(GuiRegistry::instance().customHighlightedIcon()); - customModeAction->setToolTip("Show current tab in custom mode if possible, and make this mode default for all subsequent queries (F2)"); - customModeAction->setCheckable(true); - customModeAction->setChecked(viewMode == Custom); - VERIFY(connect(customModeAction, SIGNAL(triggered()), this, SLOT(enterCustomMode()))); + _customModeAction = new QAction(this); + //_customModeAction->setShortcut(Qt::Key_F2); + _customModeAction->setIcon(GuiRegistry::instance().customHighlightedIcon()); + _customModeAction->setCheckable(true); + _customModeAction->setChecked(viewMode == Custom); + VERIFY(connect(_customModeAction, SIGNAL(triggered()), this, SLOT(enterCustomMode()))); // Execute action _executeAction = new QAction(this); _executeAction->setData("Execute"); _executeAction->setIcon(GuiRegistry::instance().executeIcon()); _executeAction->setShortcut(Qt::Key_F5); - _executeAction->setToolTip(QString("Execute query for current tab. If you have some selection in query text - only selection will be executed (F5 or %1 + Enter)").arg(controlKey)); VERIFY(connect(_executeAction, SIGNAL(triggered()), SLOT(executeScript()))); // Stop action @@ -220,201 +208,203 @@ namespace Robomongo _stopAction->setData("Stop"); _stopAction->setIcon(GuiRegistry::instance().stopIcon()); _stopAction->setShortcut(Qt::Key_F6); - _stopAction->setToolTip("Stop execution of currently running script. (F6)"); _stopAction->setDisabled(true); VERIFY(connect(_stopAction, SIGNAL(triggered()), SLOT(stopScript()))); // Refresh action - QAction *refreshAction = new QAction("Refresh", this); - refreshAction->setIcon(qApp->style()->standardIcon(QStyle::SP_BrowserReload)); - VERIFY(connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshConnections()))); - - - /*** File menu ***/ - QMenu *fileMenu = menuBar()->addMenu("File"); - fileMenu->addAction(_connectAction); - fileMenu->addSeparator(); - fileMenu->addAction(_openAction); - fileMenu->addAction(_saveAction); - fileMenu->addAction(_saveAsAction); - fileMenu->addSeparator(); - fileMenu->addAction(exitAction); - - - /*** View menu ***/ - _viewMenu = menuBar()->addMenu("View"); - // createDatabaseExplorer() adds option to toggle Explorer and Logs panels - // createStylesMenu() adds Themes submenu - - - /*** Options menu ***/ - - QMenu *optionsMenu = menuBar()->addMenu("Options"); + _refreshAction = new QAction(this); + _refreshAction->setIcon(qApp->style()->standardIcon(QStyle::SP_BrowserReload)); + VERIFY(connect(_refreshAction, SIGNAL(triggered()), this, SLOT(refreshConnections()))); + + // File menu + _fileMenu = new QMenu(this); + _fileMenu->addAction(_connectAction); + _fileMenu->addSeparator(); + _fileMenu->addAction(_openAction); + _fileMenu->addAction(_saveAction); + _fileMenu->addAction(_saveAsAction); + _fileMenu->addSeparator(); + _fileMenu->addAction(_exitAction); + menuBar()->addMenu(_fileMenu); + + // View menu + _viewMenu = new QMenu(this) ; + menuBar()->addMenu(_viewMenu); + + // Options menu + _optionsMenu = new QMenu(this); + menuBar()->addMenu(_optionsMenu); // View Mode - QMenu *defaultViewModeMenu = optionsMenu->addMenu("Default View Mode"); - defaultViewModeMenu->addAction(customModeAction); - defaultViewModeMenu->addAction(treeModeAction); - defaultViewModeMenu->addAction(tableModeAction); - defaultViewModeMenu->addAction(textModeAction); + _defaultViewModeMenu = new QMenu(this); + _defaultViewModeMenu->addAction(_customModeAction); + _defaultViewModeMenu->addAction(_treeModeAction); + _defaultViewModeMenu->addAction(_tableModeAction); + _defaultViewModeMenu->addAction(_textModeAction); + _optionsMenu->addMenu(_defaultViewModeMenu); - optionsMenu->addSeparator(); + _optionsMenu->addSeparator(); - QActionGroup *modeGroup = new QActionGroup(this); - modeGroup->addAction(textModeAction); - modeGroup->addAction(treeModeAction); - modeGroup->addAction(tableModeAction); - modeGroup->addAction(customModeAction); + _modeGroup = new QActionGroup(this); + _modeGroup->addAction(_textModeAction); + _modeGroup->addAction(_treeModeAction); + _modeGroup->addAction(_tableModeAction); + _modeGroup->addAction(_customModeAction); // Time Zone - QAction *utcTime = new QAction(convertTimesToString(Utc), this); - utcTime->setCheckable(true); - utcTime->setChecked(AppRegistry::instance().settingsManager()->timeZone() == Utc); - VERIFY(connect(utcTime, SIGNAL(triggered()), this, SLOT(setUtcTimeZone()))); + _utcTimeAction = new QAction(this); + _utcTimeAction->setCheckable(true); + _utcTimeAction->setChecked(AppRegistry::instance().settingsManager()->timeZone() == Utc); + VERIFY(connect(_utcTimeAction, SIGNAL(triggered()), this, SLOT(setUtcTimeZone()))); - QAction *localTime = new QAction(convertTimesToString(LocalTime), this); - localTime->setCheckable(true); - localTime->setChecked(AppRegistry::instance().settingsManager()->timeZone() == LocalTime); - VERIFY(connect(localTime, SIGNAL(triggered()), this, SLOT(setLocalTimeZone()))); + _localTimeAction = new QAction(this); + _localTimeAction->setCheckable(true); + _localTimeAction->setChecked(AppRegistry::instance().settingsManager()->timeZone() == LocalTime); + VERIFY(connect(_localTimeAction, SIGNAL(triggered()), this, SLOT(setLocalTimeZone()))); - QMenu *timeMenu = optionsMenu->addMenu("Display Dates In..."); - timeMenu->addAction(utcTime); - timeMenu->addAction(localTime); + _timeMenu = new QMenu(this); + _timeMenu->addAction(_utcTimeAction); + _timeMenu->addAction(_localTimeAction); + _optionsMenu->addMenu(_timeMenu); - QActionGroup *timeZoneGroup = new QActionGroup(this); - timeZoneGroup->addAction(utcTime); - timeZoneGroup->addAction(localTime); + _timeZoneGroup = new QActionGroup(this); + _timeZoneGroup->addAction(_utcTimeAction); + _timeZoneGroup->addAction(_localTimeAction); // UUID encoding - QAction *defaultEncodingAction = new QAction("Do not decode (show as is)", this); - defaultEncodingAction->setCheckable(true); - defaultEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == DefaultEncoding); - VERIFY(connect(defaultEncodingAction, SIGNAL(triggered()), this, SLOT(setDefaultUuidEncoding()))); - - QAction *javaLegacyEncodingAction = new QAction("Use Java Encoding", this); - javaLegacyEncodingAction->setCheckable(true); - javaLegacyEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == JavaLegacy); - VERIFY(connect(javaLegacyEncodingAction, SIGNAL(triggered()), this, SLOT(setJavaUuidEncoding()))); - - QAction *csharpLegacyEncodingAction = new QAction("Use .NET Encoding", this); - csharpLegacyEncodingAction->setCheckable(true); - csharpLegacyEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == CSharpLegacy); - VERIFY(connect(csharpLegacyEncodingAction, SIGNAL(triggered()), this, SLOT(setCSharpUuidEncoding()))); - - QAction *pythonEncodingAction = new QAction("Use Python Encoding", this); - pythonEncodingAction->setCheckable(true); - pythonEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == PythonLegacy); - VERIFY(connect(pythonEncodingAction, SIGNAL(triggered()), this, SLOT(setPythonUuidEncoding()))); - - QMenu *uuidMenu = optionsMenu->addMenu("Legacy UUID Encoding"); - uuidMenu->addAction(defaultEncodingAction); - uuidMenu->addAction(javaLegacyEncodingAction); - uuidMenu->addAction(csharpLegacyEncodingAction); - uuidMenu->addAction(pythonEncodingAction); - - QAction *loadMongoRcJs = new QAction("Load .mongorc.js",this); - loadMongoRcJs->setCheckable(true); - loadMongoRcJs->setChecked(AppRegistry::instance().settingsManager()->loadMongoRcJs()); - VERIFY(connect(loadMongoRcJs, SIGNAL(triggered()), this, SLOT(setLoadMongoRcJs()))); - optionsMenu->addSeparator(); - optionsMenu->addAction(loadMongoRcJs); - - optionsMenu->addSeparator(); - - QAction *autoExpand = new QAction("Auto Expand First Document", this); - autoExpand->setCheckable(true); - autoExpand->setChecked(AppRegistry::instance().settingsManager()->autoExpand()); - VERIFY(connect(autoExpand, SIGNAL(triggered()), this, SLOT(toggleAutoExpand()))); - optionsMenu->addAction(autoExpand); - - QAction *showLineNumbers = new QAction("Show Line Numbers By Default", this); - showLineNumbers->setCheckable(true); - showLineNumbers->setChecked(AppRegistry::instance().settingsManager()->lineNumbers()); - VERIFY(connect(showLineNumbers, SIGNAL(triggered()), this, SLOT(toggleLineNumbers()))); - optionsMenu->addAction(showLineNumbers); - - QAction *disabelConnectionShortcuts = new QAction("Disable Connection Shortcuts",this); - disabelConnectionShortcuts->setCheckable(true); - disabelConnectionShortcuts->setChecked(AppRegistry::instance().settingsManager()->disableConnectionShortcuts()); - VERIFY(connect(disabelConnectionShortcuts, SIGNAL(triggered()), this, SLOT(setDisableConnectionShortcuts()))); - optionsMenu->addAction(disabelConnectionShortcuts); - - QAction *preferencesAction = new QAction("Preferences",this); - VERIFY(connect(preferencesAction, SIGNAL(triggered()), this, SLOT(openPreferences()))); - preferencesAction->setVisible(false); - optionsMenu->addAction(preferencesAction); - - QActionGroup *uuidEncodingGroup = new QActionGroup(this); - uuidEncodingGroup->addAction(defaultEncodingAction); - uuidEncodingGroup->addAction(javaLegacyEncodingAction); - uuidEncodingGroup->addAction(csharpLegacyEncodingAction); - uuidEncodingGroup->addAction(pythonEncodingAction); - - /*** Window menu ***/ + _defaultEncodingAction = new QAction(this); + _defaultEncodingAction->setCheckable(true); + _defaultEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == DefaultEncoding); + VERIFY(connect(_defaultEncodingAction, SIGNAL(triggered()), this, SLOT(setDefaultUuidEncoding()))); + + _javaLegacyEncodingAction = new QAction(this); + _javaLegacyEncodingAction->setCheckable(true); + _javaLegacyEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == JavaLegacy); + VERIFY(connect(_javaLegacyEncodingAction, SIGNAL(triggered()), this, SLOT(setJavaUuidEncoding()))); + + _csharpLegacyEncodingAction = new QAction(this); + _csharpLegacyEncodingAction->setCheckable(true); + _csharpLegacyEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == CSharpLegacy); + VERIFY(connect(_csharpLegacyEncodingAction, SIGNAL(triggered()), this, SLOT(setCSharpUuidEncoding()))); + + _pythonEncodingAction = new QAction(this); + _pythonEncodingAction->setCheckable(true); + _pythonEncodingAction->setChecked(AppRegistry::instance().settingsManager()->uuidEncoding() == PythonLegacy); + VERIFY(connect(_pythonEncodingAction, SIGNAL(triggered()), this, SLOT(setPythonUuidEncoding()))); + + _uuidMenu = new QMenu(this); + _uuidMenu->addAction(_defaultEncodingAction); + _uuidMenu->addAction(_javaLegacyEncodingAction); + _uuidMenu->addAction(_csharpLegacyEncodingAction); + _uuidMenu->addAction(_pythonEncodingAction); + _optionsMenu->addMenu(_uuidMenu); + + _loadMongoRcJsAction = new QAction(this); + _loadMongoRcJsAction->setCheckable(true); + _loadMongoRcJsAction->setChecked(AppRegistry::instance().settingsManager()->loadMongoRcJs()); + VERIFY(connect(_loadMongoRcJsAction, SIGNAL(triggered()), this, SLOT(setLoadMongoRcJs()))); + _optionsMenu->addSeparator(); + _optionsMenu->addAction(_loadMongoRcJsAction); + + _optionsMenu->addSeparator(); + + _autoExpandAction = new QAction(this); + _autoExpandAction->setCheckable(true); + _autoExpandAction->setChecked(AppRegistry::instance().settingsManager()->autoExpand()); + VERIFY(connect(_autoExpandAction, SIGNAL(triggered()), this, SLOT(toggleAutoExpand()))); + _optionsMenu->addAction(_autoExpandAction); + + _showLineNumbersAction = new QAction(this); + _showLineNumbersAction->setCheckable(true); + _showLineNumbersAction->setChecked(AppRegistry::instance().settingsManager()->lineNumbers()); + VERIFY(connect(_showLineNumbersAction, SIGNAL(triggered()), this, SLOT(toggleLineNumbers()))); + _optionsMenu->addAction(_showLineNumbersAction); + + _disabelConnectionShortcutsAction = new QAction(this); + _disabelConnectionShortcutsAction->setCheckable(true); + _disabelConnectionShortcutsAction->setChecked(AppRegistry::instance().settingsManager()->disableConnectionShortcuts()); + VERIFY(connect(_disabelConnectionShortcutsAction, SIGNAL(triggered()), this, SLOT(setDisableConnectionShortcuts()))); + _optionsMenu->addAction(_disabelConnectionShortcutsAction); + + _preferencesAction = new QAction(this); + VERIFY(connect(_preferencesAction, SIGNAL(triggered()), this, SLOT(openPreferences()))); + _preferencesAction->setVisible(false); + _optionsMenu->addAction(_preferencesAction); + + _optionsMenu->addSeparator(); + createLanguagesMenu(_optionsMenu); + + _uuidEncodingGroup = new QActionGroup(this); + _uuidEncodingGroup->addAction(_defaultEncodingAction); + _uuidEncodingGroup->addAction(_javaLegacyEncodingAction); + _uuidEncodingGroup->addAction(_csharpLegacyEncodingAction); + _uuidEncodingGroup->addAction(_pythonEncodingAction); + + // Window menu // Full screen action - QAction *fullScreenAction = new QAction("&Full Screen", this); + _fullScreenAction = new QAction(this); #if !defined(Q_OS_MAC) - fullScreenAction->setShortcut(Qt::Key_F11); + _fullScreenAction->setShortcut(Qt::Key_F11); #else - fullScreenAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11)); + _fullScreenAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11)); #endif - fullScreenAction->setVisible(true); - VERIFY(connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen2()))); - + _fullScreenAction->setVisible(true); + VERIFY(connect(_fullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen2()))); + // Minimize window - QAction *minimizeAction = new QAction("&Minimize", this); - minimizeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); - minimizeAction->setVisible(true); - VERIFY(connect(minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()))); - + _minimizeAction = new QAction(this); + _minimizeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); + _minimizeAction->setVisible(true); + VERIFY(connect(_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()))); + // Next tab - QAction *nexttabAction = new QAction("Select Next Tab", this); - nexttabAction->setShortcut(QKeySequence(QKeySequence::NextChild)); - nexttabAction->setVisible(true); - VERIFY(connect(nexttabAction, SIGNAL(triggered()), this, SLOT(selectNextTab()))); + _nexttabAction = new QAction(this); + _nexttabAction->setShortcut(QKeySequence(QKeySequence::NextChild)); + _nexttabAction->setVisible(true); + VERIFY(connect(_nexttabAction, SIGNAL(triggered()), this, SLOT(selectNextTab()))); // Previous tab - QAction *prevtabAction = new QAction("Select Previous Tab", this); - prevtabAction->setShortcut(QKeySequence(QKeySequence::PreviousChild)); - prevtabAction->setVisible(true); - VERIFY(connect(prevtabAction, SIGNAL(triggered()), this, SLOT(selectPrevTab()))); + _prevtabAction = new QAction(this); + _prevtabAction->setShortcut(QKeySequence(QKeySequence::PreviousChild)); + _prevtabAction->setVisible(true); + VERIFY(connect(_prevtabAction, SIGNAL(triggered()), this, SLOT(selectPrevTab()))); // Window menu - QMenu *windowMenu = menuBar()->addMenu("Window"); - //minimize - windowMenu->addAction(fullScreenAction); - windowMenu->addAction(minimizeAction); - windowMenu->addSeparator(); - windowMenu->addAction(nexttabAction); - windowMenu->addAction(prevtabAction); - - - /*** About menu ***/ - - QAction *aboutRobomongoAction = new QAction("&About Robomongo...", this); - VERIFY(connect(aboutRobomongoAction, SIGNAL(triggered()), this, SLOT(aboutRobomongo()))); + _windowMenu = new QMenu(this); + + _windowMenu->addAction(_fullScreenAction); + _windowMenu->addAction(_minimizeAction); + _windowMenu->addSeparator(); + _windowMenu->addAction(_nexttabAction); + _windowMenu->addAction(_prevtabAction); + menuBar()->addMenu(_windowMenu); + + // About menu + _aboutRobomongoAction = new QAction(this); + VERIFY(connect(_aboutRobomongoAction, SIGNAL(triggered()), this, SLOT(aboutRobomongo()))); // Options menu - QMenu *helpMenu = menuBar()->addMenu("Help"); - helpMenu->addAction(aboutRobomongoAction); + _helpMenu = new QMenu(this); + _helpMenu->addAction(_aboutRobomongoAction); + menuBar()->addMenu(_helpMenu); // Toolbar - QToolBar *connectToolBar = new QToolBar("Toolbar", this); - connectToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); - connectToolBar->addAction(connectButtonAction); - connectToolBar->setShortcutEnabled(1, true); - connectToolBar->setMovable(false); - setToolBarIconSize(connectToolBar); - addToolBar(connectToolBar); - - QToolBar *openSaveToolBar = new QToolBar("Open/Save ToolBar", this); - openSaveToolBar->addAction(_openAction); - openSaveToolBar->addAction(_saveAction); - openSaveToolBar->setMovable(false); - setToolBarIconSize(openSaveToolBar); - addToolBar(openSaveToolBar); - - _execToolBar = new QToolBar("Exec Toolbar", this); + _connectToolBar = new QToolBar(this); + _connectToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); + _connectToolBar->addAction(connectButtonAction); + _connectToolBar->setShortcutEnabled(1, true); + _connectToolBar->setMovable(false); + setToolBarIconSize(_connectToolBar); + addToolBar(_connectToolBar); + + _openSaveToolBar = new QToolBar(this); + _openSaveToolBar->addAction(_openAction); + _openSaveToolBar->addAction(_saveAction); + _openSaveToolBar->setMovable(false); + setToolBarIconSize(_openSaveToolBar); + addToolBar(_openSaveToolBar); + + _execToolBar = new QToolBar(this); _execToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); _execToolBar->addAction(_executeAction); _execToolBar->addAction(_stopAction); @@ -428,6 +418,7 @@ namespace Robomongo createTabs(); createDatabaseExplorer(); + _viewMenu->addSeparator(); createStylesMenu(); createStatusBar(); setWindowTitle(PROJECT_NAME_TITLE" "PROJECT_VERSION); @@ -435,12 +426,115 @@ namespace Robomongo QTimer::singleShot(0, this, SLOT(manageConnections())); updateMenus(); + + retranslateUI(); } + + void MainWindow::retranslateUI() + { + QString controlKey = tr("Ctrl"); + #if defined(Q_OS_MAC) + controlKey = QChar(0x2318); // "Command" key aka Cauliflower + #endif + + _explorerDock->setWindowTitle(tr("Database Explorer")); + _logDock->setWindowTitle(tr("Logs")); + + _logButton->setText(tr("Logs")); + + _openAction->setText(tr("&Open...")); + _openAction->setToolTip(tr("Load script from the file to the currently opened shell")); + + _saveAction->setText(tr("&Save")); + _saveAction->setToolTip(tr("Save script of the currently opened shell to the file (%1 + S)").arg(controlKey)); + + _saveAsAction->setText(tr("Save &As...")); + + _exitAction->setText(tr("&Exit")); + + _connectAction->setText(tr("&Connect...")); + _connectAction->setIconText(tr("Connect")); + _connectAction->setToolTip(tr("Connect to local or remote MongoDB instance (%1 + O)").arg(controlKey)); + + _connectButton->setText(tr("&Connect...")); + _connectButton->setToolTip(tr("Connect to local or remote MongoDB instance (%1 + O)").arg(controlKey)); + + _orientationAction->setText(tr("&Rotate")); + _orientationAction->setToolTip(tr("Toggle orientation of results view (F10)")); + + _textModeAction->setText(tr("&Text Mode")); + _textModeAction->setToolTip(tr("Show current tab in text mode, and make this mode default for all subsequent queries (F4)")); + + _treeModeAction->setText(tr("&Tree Mode")); + _treeModeAction->setToolTip(tr("Show current tab in tree mode, and make this mode default for all subsequent queries (F3)")); + _tableModeAction->setText(tr("T&able Mode")); + _tableModeAction->setToolTip(tr("Show current tab in table mode, and make this mode default for all subsequent queries (F3)")); + + _customModeAction->setText(tr("&Custom Mode")); + _customModeAction->setToolTip(tr("Show current tab in custom mode if possible, and make this mode default for all subsequent queries (F2)")); + + _executeAction->setToolTip(tr("Execute query for current tab. If you have some selection in query text - only selection will be executed (F5 or %1 + Enter)").arg(controlKey)); + + _stopAction->setToolTip(tr("Stop execution of currently running script. (F6)")); + + _refreshAction->setText(tr("Refresh")); + + _utcTimeAction->setText(convertTimesToString(Utc)); + _localTimeAction->setText(convertTimesToString(LocalTime)); + + _defaultEncodingAction->setText(tr("Do not decode (show as is)")); + _javaLegacyEncodingAction->setText(tr("Use Java Encoding")); + _csharpLegacyEncodingAction->setText(tr("Use .NET Encoding")); + _pythonEncodingAction->setText(tr("Use Python Encoding")); + + _loadMongoRcJsAction->setText(tr("Load .mongorc.js")); + + _autoExpandAction->setText(tr("Auto Expand First Document")); + + _showLineNumbersAction->setText(tr("Show Line Numbers By Default")); + + _disabelConnectionShortcutsAction->setText(tr("Disable Connection Shortcuts")); + + _preferencesAction->setText(tr("Preferences")); + + _aboutRobomongoAction->setText(tr("&About Robomongo...")); + + _explorerAction->setText(tr("&Explorer")); + _explorerAction->setStatusTip(tr("Press to show/hide Database Explorer panel.")); + _logAction->setText(tr("&Logs")); + //_logAction->setStatusTip(QString("Press to show/hide Logs panel.")); //commented for now because this message hides Logs button in status bar :) + + _fileMenu->setTitle(tr("File")); + _viewMenu->setTitle(tr("View")); + _stylesMenu->setTitle(tr("Theme")); + _optionsMenu->setTitle(tr("Options")); + _defaultViewModeMenu->setTitle(tr("Default View Mode")); + _timeMenu->setTitle(tr("Display Dates In...")); + _uuidMenu->setTitle(tr("Legacy UUID Encoding")); + + _languagesMenu->setTitle(tr("Language")); + //: Language based on system locale + _localeLanguageAction->setText(tr("System locale (if available)")); + + _windowMenu->setTitle(tr("Window")); + _fullScreenAction->setText(tr("&Full Screen")); + _minimizeAction->setText(tr("&Minimize")); + _nexttabAction->setText(tr("Select Next Tab")); + _prevtabAction->setText(tr("Select Previous Tab")); + + _helpMenu->setTitle(tr("Help")); + + _connectToolBar->setWindowTitle(tr("Toolbar")); + _openSaveToolBar->setWindowTitle(tr("Open/Save ToolBar")); + _execToolBar->setWindowTitle(tr("Exec Toolbar")); + + updateConnectionsMenu(); + } + void MainWindow::createStylesMenu() { - _viewMenu->addSeparator(); - QMenu *styles = _viewMenu->addMenu("Theme"); + _stylesMenu = new QMenu(this); QStringList supportedStyles = detail::getSupportedStyles(); QActionGroup *styleGroup = new QActionGroup(this); VERIFY(connect(styleGroup, SIGNAL(triggered(QAction *)), this, SLOT(changeStyle(QAction *)))); @@ -451,8 +545,31 @@ namespace Robomongo styleAction->setCheckable(true); styleAction->setChecked(style == currentStyle); styleGroup->addAction(styleAction); - styles->addAction(styleAction); + _stylesMenu->addAction(styleAction); + } + _viewMenu->addMenu(_stylesMenu); + } + + void MainWindow::createLanguagesMenu(QMenu *parentMenu) + { + _languagesMenu = new QMenu(this); + QMap providedTranslations = AppRegistry::instance().settingsManager()->getTranslations(); + const QString ¤tTranslation = AppRegistry::instance().settingsManager()->currentTranslation(); + QActionGroup *langGroup = new QActionGroup(this); + VERIFY(connect(langGroup, SIGNAL(triggered(QAction *)), this, SLOT(changeTranslation(QAction *)))); + for (QMap::const_iterator it = providedTranslations.begin(); it != providedTranslations.end(); ++it) { + const QString &language = it.value(); + QAction *langAction = new QAction(language,this); + if (it.key() == "") { + _localeLanguageAction = langAction; + } + langAction->setCheckable(true); + langAction->setChecked(it.key() == currentTranslation); + langAction->setData(it.key()); + langGroup->addAction(langAction); + _languagesMenu->addAction(langAction); } + parentMenu->addMenu(_languagesMenu); } void MainWindow::createStatusBar() @@ -462,11 +579,10 @@ namespace Robomongo QColor buttonBorderBgColor = windowColor.darker(120); QColor buttonPressedColor = windowColor.darker(102); - QToolButton *log = new QToolButton(this); - log->setText("Logs"); - log->setCheckable(true); - log->setDefaultAction(_logDock->toggleViewAction()); - log->setStyleSheet(QString( + _logButton = new QToolButton(this); + _logButton->setCheckable(true); + _logButton->setDefaultAction(_logDock->toggleViewAction()); + _logButton->setStyleSheet(QString( "QToolButton {" " background-color: %1;" " border-style: outset;" @@ -484,7 +600,7 @@ namespace Robomongo .arg(buttonBorderBgColor.name()) .arg(buttonPressedColor.name())); - statusBar()->insertWidget(0, log); + statusBar()->insertWidget(0, _logButton); statusBar()->setStyleSheet("QStatusBar::item { border: 0px solid black };"); } @@ -496,6 +612,18 @@ namespace Robomongo AppRegistry::instance().settingsManager()->save(); } + void MainWindow::changeTranslation(QAction *ac) + { + const QString &text = ac->text(); + const QString &translation = ac->data().toString(); + AppRegistry::instance().settingsManager()->switchTranslator(translation); +// QMessageBox::information(this, PROJECT_NAME_TITLE, +// tr("You need to restart %1 for language change take effect").arg(PROJECT_NAME_TITLE), +// QMessageBox::Ok, +// QMessageBox::Ok +// ); + } + void MainWindow::open() { QueryWidget *wid = _workArea->currentQueryWidget(); @@ -562,9 +690,9 @@ namespace Robomongo _connectionsMenu->addSeparator(); // Connect action - QAction *connectAction = new QAction("&Manage Connections...", this); + QAction *connectAction = new QAction(tr("&Manage Connections..."), this); connectAction->setIcon(GuiRegistry::instance().connectIcon()); - connectAction->setToolTip("Connect to MongoDB"); + connectAction->setToolTip(tr("Connect to MongoDB")); VERIFY(connect(connectAction, SIGNAL(triggered()), this, SLOT(manageConnections()))); _connectionsMenu->addAction(connectAction); @@ -585,8 +713,8 @@ namespace Robomongo try { _app->openServer(selected, true); } catch(const std::exception &) { - QString message = QString("Cannot connect to MongoDB (%1)").arg(QtUtils::toQString(selected->getFullAddress())); - QMessageBox::information(this, "Error", message); + QString message = tr("Cannot connect to MongoDB (%1)").arg(QtUtils::toQString(selected->getFullAddress())); + QMessageBox::information(this, tr("Error"), message); } } @@ -700,8 +828,8 @@ namespace Robomongo void MainWindow::refreshConnections() { - QToolTip::showText(QPoint(0,0), - QString("Refresh not working yet... :
Ctrl+D : push Button")); + QToolTip::showText(QPoint(0, 0), + tr("Refresh not working yet... :
Ctrl+D : push Button")); } void MainWindow::aboutRobomongo() @@ -780,16 +908,16 @@ namespace Robomongo _app->openServer(ptr, true); } catch(const std::exception &) { - QString message = QString("Cannot connect to MongoDB (%1)").arg(QtUtils::toQString(ptr->getFullAddress())); - QMessageBox::information(this, "Error", message); + QString message = tr("Cannot connect to MongoDB (%1)").arg(QtUtils::toQString(ptr->getFullAddress())); + QMessageBox::information(this, tr("Error"), message); } } void MainWindow::handle(ConnectionFailedEvent *event) { ConnectionSettings *connection = event->server->connectionRecord(); - QString message = QString("Cannot connect to MongoDB (%1),\nerror: %2").arg(QtUtils::toQString(connection->getFullAddress())).arg(QtUtils::toQString(event->error().errorMessage())); - QMessageBox::information(this, "Error", message); + QString message = tr("Cannot connect to MongoDB (%1),\nerror: %2").arg(QtUtils::toQString(connection->getFullAddress())).arg(QtUtils::toQString(event->error().errorMessage())); + QMessageBox::information(this, tr("Error"), message); } void MainWindow::handle(ScriptExecutingEvent *) @@ -816,38 +944,34 @@ namespace Robomongo AppRegistry::instance().bus()->subscribe(explorer, ConnectionFailedEvent::Type); AppRegistry::instance().bus()->subscribe(explorer, ConnectionEstablishedEvent::Type); - QDockWidget *explorerDock = new QDockWidget(tr("Database Explorer")); - explorerDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - explorerDock->setWidget(explorer); - explorerDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable); + _explorerDock = new QDockWidget(this); + _explorerDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + _explorerDock->setWidget(explorer); + _explorerDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable); QWidget *titleWidget = new QWidget(this); // this lines simply remove - explorerDock->setTitleBarWidget(titleWidget); // title bar widget. - - QAction *actionExp = explorerDock->toggleViewAction(); + _explorerDock->setTitleBarWidget(titleWidget); // title bar widget. + _explorerAction = _explorerDock->toggleViewAction(); + // Adjust any parameter you want. - actionExp->setText(QString("&Explorer")); - actionExp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); - actionExp->setStatusTip(QString("Press to show/hide Database Explorer panel.")); - actionExp->setChecked(true); + _explorerAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); + _explorerAction->setChecked(true); // Install action in the menu. - _viewMenu->addAction(actionExp); + _viewMenu->addAction(_explorerAction); - addDockWidget(Qt::LeftDockWidgetArea, explorerDock); + addDockWidget(Qt::LeftDockWidgetArea, _explorerDock); LogWidget *log = new LogWidget(this); VERIFY(connect(&Logger::instance(), SIGNAL(printed(const QString&, mongo::LogLevel)), log, SLOT(addMessage(const QString&, mongo::LogLevel)))); - _logDock = new QDockWidget(tr("Logs")); - QAction *action = _logDock->toggleViewAction(); + _logDock = new QDockWidget(); + _logAction = _logDock->toggleViewAction(); // Adjust any parameter you want. - action->setText(QString("&Logs")); - action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); - //action->setStatusTip(QString("Press to show/hide Logs panel.")); //commented for now because this message hides Logs button in status bar :) - action->setChecked(false); + _logAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L)); + _logAction->setChecked(false); // Install action in the menu. - _viewMenu->addAction(action); - + _viewMenu->addAction(_logAction); + _logDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea); _logDock->setWidget(log); _logDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable); @@ -880,4 +1004,22 @@ namespace Robomongo setCentralWidget(window); } + + void MainWindow::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); +// Robomongo::LOG_MSG("QEvent::LanguageChange", mongo::LL_INFO); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + Robomongo::LOG_MSG("QEvent::LocaleChange", mongo::LL_INFO); + break; + } + } + BaseClass::changeEvent(event); + } } diff --git a/src/robomongo/gui/MainWindow.h b/src/robomongo/gui/MainWindow.h index 545f74d23..189c85110 100644 --- a/src/robomongo/gui/MainWindow.h +++ b/src/robomongo/gui/MainWindow.h @@ -1,6 +1,10 @@ #pragma once +#include #include +#include +#include "../core/utils/QtUtils.h" + QT_BEGIN_NAMESPACE class QLabel; class QToolBar; @@ -8,7 +12,7 @@ class QDockWidget; class QToolButton; QT_END_NAMESPACE -namespace Robomongo + namespace Robomongo { class ConnectionFailedEvent; class ScriptExecutingEvent; @@ -47,6 +51,7 @@ namespace Robomongo void save(); void saveAs(); void changeStyle(QAction *); + void changeTranslation(QAction *); void setDefaultUuidEncoding(); void setJavaUuidEncoding(); @@ -61,6 +66,10 @@ namespace Robomongo void handle(ScriptExecutingEvent *event); void handle(ScriptExecutedEvent *event); void handle(QueryWidgetUpdatedEvent *event); + + protected: + void changeEvent(QEvent* event); + private Q_SLOTS: void updateMenus(); void setUtcTimeZone(); @@ -69,27 +78,79 @@ namespace Robomongo private: QDockWidget *_logDock; + QDockWidget *_explorerDock; WorkAreaTabWidget *_workArea; App *_app; ConnectionMenu *_connectionsMenu; + QToolButton *_connectButton; - QMenu *_viewMenu; + QToolButton *_logButton; + QAction *_connectAction; QAction *_openAction; QAction *_saveAction; QAction *_saveAsAction; + QAction *_exitAction; + QAction *_orientationAction; + QAction *_textModeAction; + QAction *_treeModeAction; + QAction *_tableModeAction; + QAction *_customModeAction; QAction *_executeAction; QAction *_stopAction; - QAction *_orientationAction; + QAction *_refreshAction; + QAction *_utcTimeAction; + QAction *_localTimeAction; + QAction *_defaultEncodingAction; + QAction *_javaLegacyEncodingAction; + QAction *_csharpLegacyEncodingAction; + QAction *_pythonEncodingAction; + QAction *_loadMongoRcJsAction; + QAction *_autoExpandAction; + QAction *_showLineNumbersAction; + QAction *_disabelConnectionShortcutsAction; + QAction *_preferencesAction; + QAction *_localeLanguageAction; + + QAction *_fullScreenAction; + QAction *_minimizeAction; + QAction *_nexttabAction; + QAction *_prevtabAction; + + QAction *_aboutRobomongoAction; + + QAction *_explorerAction; + QAction *_logAction; + + QActionGroup *_modeGroup; + QActionGroup *_timeZoneGroup; + QActionGroup *_uuidEncodingGroup; + + QMenu *_fileMenu; + QMenu *_viewMenu; + QMenu *_stylesMenu; + QMenu *_optionsMenu; + QMenu *_defaultViewModeMenu; + QMenu *_timeMenu; + QMenu *_uuidMenu; + QMenu *_languagesMenu; + QMenu *_windowMenu; + QMenu *_helpMenu; + QToolBar *_execToolBar; + QToolBar *_connectToolBar; + QToolBar *_openSaveToolBar; + + void retranslateUI(); void updateConnectionsMenu(); void createDatabaseExplorer(); void createTabs(); void createStylesMenu(); + void createLanguagesMenu(QMenu *parentMenu); void createStatusBar(); }; diff --git a/src/robomongo/gui/dialogs/AboutDialog.cpp b/src/robomongo/gui/dialogs/AboutDialog.cpp index 58e963040..dc92ff10d 100644 --- a/src/robomongo/gui/dialogs/AboutDialog.cpp +++ b/src/robomongo/gui/dialogs/AboutDialog.cpp @@ -8,24 +8,6 @@ #include "robomongo/gui/GuiRegistry.h" #include "robomongo/core/utils/QtUtils.h" -namespace -{ - const QString description = QObject::tr( - "

"PROJECT_NAME_TITLE" "PROJECT_VERSION"

" - "Shell-centric MongoDB management tool." - "
" - "
" - "Visit "PROJECT_NAME_TITLE" website: "PROJECT_DOMAIN"
" - "
" - "Fork project or submit issues/proposals on GitHub.
" - "
" - "Copyright 2013 "PROJECT_COMPANYNAME". All rights reserved.
" - "
" - "The program is provided AS IS with NO WARRANTY OF ANY KIND, " - "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " - "PARTICULAR PURPOSE.
"); -} - namespace Robomongo { AboutDialog::AboutDialog(QWidget *parent) @@ -33,11 +15,26 @@ namespace Robomongo { setWindowIcon(GuiRegistry::instance().mainWindowIcon()); - setWindowTitle("About "PROJECT_NAME_TITLE); + setWindowTitle(tr("About ")+PROJECT_NAME_TITLE); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QGridLayout *layout = new QGridLayout(this); layout->setSizeConstraint(QLayout::SetFixedSize); + const QString description = + "

"PROJECT_NAME_TITLE" "PROJECT_VERSION"

" + + tr("Shell-centric MongoDB management tool.") + + "
" + "
" + + tr("Visit %1 %2", "project title, 'website' word").arg(PROJECT_NAME_TITLE).arg(tr(" website")) + ": "PROJECT_DOMAIN"
" + "
" + "" + tr("Fork") + " " + tr("project or ") + "" + tr("submit") + " " + tr("issues/proposals on GitHub.") + "
" + "
" + "Copyright 2013 "PROJECT_COMPANYNAME". " + tr("All rights reserved") + ".
" + "
" + + tr("The program is provided AS IS with NO WARRANTY OF ANY KIND, " + "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A " + "PARTICULAR PURPOSE.") + "
"; + QLabel *copyRightLabel = new QLabel(description); copyRightLabel->setWordWrap(true); copyRightLabel->setOpenExternalLinks(true); diff --git a/src/robomongo/gui/dialogs/ConnectionAdvancedTab.cpp b/src/robomongo/gui/dialogs/ConnectionAdvancedTab.cpp index 4cf18cfc9..b537c9d19 100644 --- a/src/robomongo/gui/dialogs/ConnectionAdvancedTab.cpp +++ b/src/robomongo/gui/dialogs/ConnectionAdvancedTab.cpp @@ -14,9 +14,9 @@ namespace Robomongo _settings(settings) { QLabel *defaultDatabaseDescriptionLabel = new QLabel( - "Database, that will be default (db shell variable will point to this database). " + tr("Database, that will be default (db shell variable will point to this database). " "By default, default database will be the one you authenticate on, or test otherwise. " - "Leave this field empty, if you want default behaviour."); + "Leave this field empty, if you want default behaviour.")); defaultDatabaseDescriptionLabel->setWordWrap(true); defaultDatabaseDescriptionLabel->setContentsMargins(0, -2, 0, 20); @@ -24,7 +24,7 @@ namespace Robomongo QGridLayout *connectionLayout = new QGridLayout; connectionLayout->setAlignment(Qt::AlignTop); - connectionLayout->addWidget(new QLabel("Default Database:"), 1, 0); + connectionLayout->addWidget(new QLabel(tr("Default Database:")), 1, 0); connectionLayout->addWidget(_defaultDatabaseName, 1, 1, 1, 1); connectionLayout->addWidget(defaultDatabaseDescriptionLabel, 2, 1, 1, 1); diff --git a/src/robomongo/gui/dialogs/ConnectionAuthTab.cpp b/src/robomongo/gui/dialogs/ConnectionAuthTab.cpp index 1cd517d5e..289e1c04c 100644 --- a/src/robomongo/gui/dialogs/ConnectionAuthTab.cpp +++ b/src/robomongo/gui/dialogs/ConnectionAuthTab.cpp @@ -16,9 +16,9 @@ namespace Robomongo _settings(settings) { _databaseNameDescriptionLabel = new QLabel( - "The admin database is unique in MongoDB. Users with normal access " + tr("The admin database is unique in MongoDB. Users with normal access " "to the admin database have read and write access to all " - "databases."); + "databases.")); _databaseNameDescriptionLabel->setWordWrap(true); _databaseNameDescriptionLabel->setAlignment(Qt::AlignTop); @@ -26,18 +26,18 @@ namespace Robomongo _databaseNameDescriptionLabel->setMinimumSize(_databaseNameDescriptionLabel->sizeHint()); _userName = new QLineEdit(); - _userNameLabel = new QLabel("User Name"); + _userNameLabel = new QLabel(tr("User Name")); _userPassword = new QLineEdit(); _userPassword->setEchoMode(QLineEdit::Password); - _userPasswordLabel = new QLabel("Password"); + _userPasswordLabel = new QLabel(tr("Password")); _databaseName = new QLineEdit("admin"); - _databaseNameLabel = new QLabel("Database"); + _databaseNameLabel = new QLabel(tr("Database")); - _useAuth = new QCheckBox("Perform authentication"); + _useAuth = new QCheckBox(tr("Perform authentication")); _useAuth->setStyleSheet("margin-bottom: 7px"); VERIFY(connect(_useAuth, SIGNAL(toggled(bool)), this, SLOT(authChecked(bool)))); - _echoModeButton = new QPushButton("Show"); + _echoModeButton = new QPushButton(tr("Show")); VERIFY(connect(_echoModeButton, SIGNAL(clicked()), this, SLOT(toggleEchoMode()))); _useAuth->setChecked(_settings->hasEnabledPrimaryCredential()); @@ -89,7 +89,7 @@ namespace Robomongo { bool isPassword = _userPassword->echoMode() == QLineEdit::Password; _userPassword->setEchoMode(isPassword ? QLineEdit::Normal: QLineEdit::Password); - _echoModeButton->setText(isPassword ? "Hide": "Show"); + _echoModeButton->setText(isPassword ? tr("Hide") : tr("Show")); } void ConnectionAuthTab::authChecked(bool checked) diff --git a/src/robomongo/gui/dialogs/ConnectionBasicTab.cpp b/src/robomongo/gui/dialogs/ConnectionBasicTab.cpp index 4e15a68cd..3209d5e26 100644 --- a/src/robomongo/gui/dialogs/ConnectionBasicTab.cpp +++ b/src/robomongo/gui/dialogs/ConnectionBasicTab.cpp @@ -17,12 +17,12 @@ namespace Robomongo _settings(settings) { QLabel *connectionDescriptionLabel = new QLabel( - "Choose any connection name that will help you to identify this connection."); + tr("Choose any connection name that will help you to identify this connection.")); connectionDescriptionLabel->setWordWrap(true); connectionDescriptionLabel->setContentsMargins(0, -2, 0, 20); QLabel *serverDescriptionLabel = new QLabel( - "Specify host and port of MongoDB server. Host can be either IP or domain name."); + tr("Specify host and port of MongoDB server. Host can be either IP or domain name.")); serverDescriptionLabel->setWordWrap(true); serverDescriptionLabel->setContentsMargins(0, -2, 0, 20); @@ -35,10 +35,10 @@ namespace Robomongo QGridLayout *connectionLayout = new QGridLayout; connectionLayout->setAlignment(Qt::AlignTop); - connectionLayout->addWidget(new QLabel("Name:"), 1, 0); + connectionLayout->addWidget(new QLabel(tr("Name:")), 1, 0); connectionLayout->addWidget(_connectionName, 1, 1, 1, 3); connectionLayout->addWidget(connectionDescriptionLabel, 2, 1, 1, 3); - connectionLayout->addWidget(new QLabel("Address:"), 3, 0); + connectionLayout->addWidget(new QLabel(tr("Address:")), 3, 0); connectionLayout->addWidget(_serverAddress, 3, 1); connectionLayout->addWidget(new QLabel(":"), 3, 2); connectionLayout->addWidget(_serverPort, 3, 3); diff --git a/src/robomongo/gui/dialogs/ConnectionDiagnosticDialog.cpp b/src/robomongo/gui/dialogs/ConnectionDiagnosticDialog.cpp index 91dadbb84..3058184c2 100644 --- a/src/robomongo/gui/dialogs/ConnectionDiagnosticDialog.cpp +++ b/src/robomongo/gui/dialogs/ConnectionDiagnosticDialog.cpp @@ -22,7 +22,7 @@ namespace Robomongo _connectionStatusReceived(false), _authStatusReceived(false) { - setWindowTitle("Diagnostic"); + setWindowTitle(tr("Diagnostic")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?) //setFixedSize(dialogSize); @@ -31,7 +31,7 @@ namespace Robomongo _yesPixmap = _yesIcon.pixmap(24, 24); _noPixmap = _noIcon.pixmap(24, 24); - QPushButton *closeButton = new QPushButton("&Close"); + QPushButton *closeButton = new QPushButton(tr("&Close")); VERIFY(connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()))); _connectionIconLabel = new QLabel; _authIconLabel = new QLabel; @@ -44,14 +44,14 @@ namespace Robomongo _connectionIconLabel->setMovie(_loadingMovie); _authIconLabel->setMovie(_loadingMovie); - _connectionLabel->setText(QString("Connecting to %1...").arg(QtUtils::toQString(_connection->getFullAddress()))); + _connectionLabel->setText(tr("Connecting to %1...").arg(QtUtils::toQString(_connection->getFullAddress()))); if (_connection->hasEnabledPrimaryCredential()) { - _authLabel->setText(QString("Authorizing on %1 database as %2...") + _authLabel->setText(tr("Authorizing on %1 database as %2...") .arg(QtUtils::toQString(_connection->primaryCredential()->databaseName())) .arg(QtUtils::toQString(_connection->primaryCredential()->userName()))); } else { - _authLabel->setText("Authorization skipped by you"); + _authLabel->setText(tr("Authorization skipped by you")); } QGridLayout *layout = new QGridLayout(); @@ -82,10 +82,10 @@ namespace Robomongo if (connected) { _connectionIconLabel->setPixmap(_yesPixmap); - _connectionLabel->setText(QString("Connected to %1").arg(QtUtils::toQString(_connection->getFullAddress()))); + _connectionLabel->setText(tr("Connected to %1").arg(QtUtils::toQString(_connection->getFullAddress()))); } else { _connectionIconLabel->setPixmap(_noPixmap); - _connectionLabel->setText(QString("Unable to connect to %1").arg(QtUtils::toQString(_connection->getFullAddress()))); + _connectionLabel->setText(tr("Unable to connect to %1").arg(QtUtils::toQString(_connection->getFullAddress()))); } layout()->activate(); @@ -98,15 +98,15 @@ namespace Robomongo if (authed) { _authIconLabel->setPixmap(_yesPixmap); - _authLabel->setText(QString("Authorized as %1").arg(QtUtils::toQString(_connection->primaryCredential()->userName()))); + _authLabel->setText(tr("Authorized as %1").arg(QtUtils::toQString(_connection->primaryCredential()->userName()))); } else { _authIconLabel->setPixmap(_noPixmap); if (_connection->hasEnabledPrimaryCredential()) - _authLabel->setText(QString("Authorization failed")); + _authLabel->setText(tr("Authorization failed")); else - _authLabel->setText(QString("Authorization skipped by you")); + _authLabel->setText(tr("Authorization skipped by you")); } layout()->activate(); diff --git a/src/robomongo/gui/dialogs/ConnectionDialog.cpp b/src/robomongo/gui/dialogs/ConnectionDialog.cpp index f88d930ce..88e53e647 100644 --- a/src/robomongo/gui/dialogs/ConnectionDialog.cpp +++ b/src/robomongo/gui/dialogs/ConnectionDialog.cpp @@ -28,7 +28,7 @@ namespace Robomongo : QDialog(), _connection(connection) { - setWindowTitle("Connection Settings"); + setWindowTitle(tr("Connection Settings")); setWindowIcon(GuiRegistry::instance().serverIcon()); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?) setMinimumWidth(450); @@ -57,9 +57,9 @@ namespace Robomongo _sshTab = new SshTunelTab(_connection); #endif - tabWidget->addTab(_basicTab, "Connection"); - tabWidget->addTab(_authTab, "Authentication"); - tabWidget->addTab(_advancedTab, "Advanced"); + tabWidget->addTab(_basicTab, tr("Connection")); + tabWidget->addTab(_authTab, tr("Authentication")); + tabWidget->addTab(_advancedTab, tr("Advanced")); tabWidget->addTab(_sslTab, "SSL"); #ifdef SSH_SUPPORT_ENABLED tabWidget->addTab(_sshTab, "SSH"); @@ -88,7 +88,7 @@ namespace Robomongo #ifdef SSH_SUPPORT_ENABLED bool isSshAndSsl = _sslTab->isSslSupported() && _sshTab->isSshSupported(); if (isSshAndSsl) { - QMessageBox::warning(this, "Invalid Transport", "SSH and SSL cannot be enabled simultaneously. Please uncheck one of them."); + QMessageBox::warning(this, tr("Invalid Transport"), tr("SSH and SSL cannot be enabled simultaneously. Please uncheck one of them.")); return false; } #endif diff --git a/src/robomongo/gui/dialogs/ConnectionSslTab.cpp b/src/robomongo/gui/dialogs/ConnectionSslTab.cpp index 410f78734..7aea44737 100644 --- a/src/robomongo/gui/dialogs/ConnectionSslTab.cpp +++ b/src/robomongo/gui/dialogs/ConnectionSslTab.cpp @@ -31,7 +31,7 @@ namespace Robomongo _sslPemFilePath->setValidator(new QRegExpValidator(pathx, this)); */ - _sslSupport = new QCheckBox("Use SSL protocol"); + _sslSupport = new QCheckBox(tr("Use SSL protocol")); _sslSupport->setStyleSheet("margin-bottom: 7px"); _sslSupport->setChecked(_settings->sslInfo()._sslSupport); @@ -39,18 +39,18 @@ namespace Robomongo _selectPemFileButton->setFixedSize(20,20); VERIFY(connect(_selectPemFileButton, SIGNAL(clicked()), this, SLOT(setSslPEMKeyFile()))); - _sslPemLabel = new QLabel("SSL Certificate:"); + _sslPemLabel = new QLabel(tr("SSL Certificate:")); _sslPemDescriptionLabel = new QLabel( - "SSL Certificate and SSL Private Key combined into one file (*.pem)"); + tr("SSL Certificate and SSL Private Key combined into one file (*.pem)")); _sslPemDescriptionLabel->setWordWrap(true); _sslPemDescriptionLabel->setAlignment(Qt::AlignTop); _sslPemDescriptionLabel->setContentsMargins(0, -2, 0, 0); _sslPemDescriptionLabel->setMinimumSize(_sslPemDescriptionLabel->sizeHint()); QLabel *sslNoteLabel = new QLabel( - "Note: Support for Certificate Authority (CA) file and " - "encrypted SSL Private Keys are planned for future releases."); + tr("Note: Support for Certificate Authority (CA) file and " + "encrypted SSL Private Keys are planned for future releases.")); sslNoteLabel->setWordWrap(true); sslNoteLabel->setAlignment(Qt::AlignTop); sslNoteLabel->setContentsMargins(0, 20, 0, 0); @@ -74,7 +74,7 @@ namespace Robomongo void ConnectionSslTab::setSslPEMKeyFile() { - QString filepath = QFileDialog::getOpenFileName(this, "Select SSL Key File (PEM)", "", QObject::tr("PEM files (*.pem)")); + QString filepath = QFileDialog::getOpenFileName(this, tr("Select SSL Key File (PEM)"), "", tr("PEM files (*.pem)")); if (filepath.isNull()) return; diff --git a/src/robomongo/gui/dialogs/ConnectionsDialog.cpp b/src/robomongo/gui/dialogs/ConnectionsDialog.cpp index a121e59cb..eae79a78d 100644 --- a/src/robomongo/gui/dialogs/ConnectionsDialog.cpp +++ b/src/robomongo/gui/dialogs/ConnectionsDialog.cpp @@ -68,21 +68,21 @@ namespace Robomongo : QDialog(parent), _settingsManager(settingsManager) { setWindowIcon(GuiRegistry::instance().connectIcon()); - setWindowTitle("MongoDB Connections"); + setWindowTitle(tr("MongoDB Connections")); // Remove help button (?) setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); - QAction *addAction = new QAction("&Add...", this); + QAction *addAction = new QAction(tr("&Add..."), this); VERIFY(connect(addAction, SIGNAL(triggered()), this, SLOT(add()))); - QAction *editAction = new QAction("&Edit...", this); + QAction *editAction = new QAction(tr("&Edit..."), this); VERIFY(connect(editAction, SIGNAL(triggered()), this, SLOT(edit()))); - QAction *cloneAction = new QAction("&Clone...", this); + QAction *cloneAction = new QAction(tr("&Clone..."), this); VERIFY(connect(cloneAction, SIGNAL(triggered()), this, SLOT(clone()))); - QAction *removeAction = new QAction("&Remove...", this); + QAction *removeAction = new QAction(tr("&Remove..."), this); VERIFY(connect(removeAction, SIGNAL(triggered()), this, SLOT(remove()))); _listWidget = new ConnectionsTreeWidget; @@ -90,7 +90,7 @@ namespace Robomongo _listWidget->setIndentation(5); QStringList colums; - colums << "Name" << "Address" << "Auth. Database / User"; + colums << tr("Name") << tr("Address") << tr("Auth. Database / User"); _listWidget->setHeaderLabels(colums); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) _listWidget->header()->setSectionResizeMode(0, QHeaderView::Stretch); @@ -115,7 +115,7 @@ namespace Robomongo buttonBox->setOrientation(Qt::Horizontal); buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); buttonBox->button(QDialogButtonBox::Save)->setIcon(GuiRegistry::instance().serverIcon()); - buttonBox->button(QDialogButtonBox::Save)->setText("C&onnect"); + buttonBox->button(QDialogButtonBox::Save)->setText(tr("C&onnect")); VERIFY(connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()))); VERIFY(connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()))); @@ -123,8 +123,8 @@ namespace Robomongo bottomLayout->addWidget(buttonBox); QLabel *intro = new QLabel( - "Create, " - "edit, remove, clone or reorder connections via drag'n'drop."); + ""+tr("Create")+", " + ""+tr("edit")+", "+tr("remove")+", "+tr("clone")+" "+tr("or reorder connections via drag'n'drop.")); intro->setWordWrap(true); VERIFY(connect(intro, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString)))); @@ -252,8 +252,8 @@ namespace Robomongo // Ask user int answer = QMessageBox::question(this, - "Connections", - QString("Really delete \"%1\" connection?").arg(QtUtils::toQString(connectionModel->getReadableName())), + tr("Connections"), + tr("Really delete \"%1\" connection?").arg(QtUtils::toQString(connectionModel->getReadableName())), QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); if (answer != QMessageBox::Yes) @@ -274,7 +274,7 @@ namespace Robomongo // Clone connection ConnectionSettings *connection = currentItem->connection()->clone(); - std::string newConnectionName="Copy of "+connection->connectionName(); + std::string newConnectionName=tr("Copy of %1").arg(connection->connectionName().c_str()).toStdString(); connection->setConnectionName(newConnectionName); diff --git a/src/robomongo/gui/dialogs/CopyCollectionDialog.cpp b/src/robomongo/gui/dialogs/CopyCollectionDialog.cpp index b14f976a6..153435166 100644 --- a/src/robomongo/gui/dialogs/CopyCollectionDialog.cpp +++ b/src/robomongo/gui/dialogs/CopyCollectionDialog.cpp @@ -36,7 +36,7 @@ namespace Robomongo } } - setWindowTitle("Copy Collection"); + setWindowTitle(tr("Copy Collection")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?) setMinimumSize(minimumSize); @@ -49,7 +49,7 @@ namespace Robomongo _buttonBox = new QDialogButtonBox(this); _buttonBox->setOrientation(Qt::Horizontal); _buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); - _buttonBox->button(QDialogButtonBox::Save)->setText("Copy"); + _buttonBox->button(QDialogButtonBox::Save)->setText(tr("Copy")); VERIFY(connect(_buttonBox, SIGNAL(accepted()), this, SLOT(accept()))); VERIFY(connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()))); @@ -65,9 +65,9 @@ namespace Robomongo QVBoxLayout *serverlayout = new QVBoxLayout(); serverlayout->setContentsMargins(0, 3, 0, 0); _serverComboBox = new QComboBox(); - QLabel *serverLabel = new QLabel("Select server:"); + QLabel *serverLabel = new QLabel(tr("Select server:")); QLabel *description = new QLabel( - QString("Copy %1 collection to database on this or another server. " + tr("Copy %1 collection to database on this or another server. " "You need to be already connected to destination server, in order to see this server in the list below. " "This operation will not overwrite existing documents with the same _id.") .arg(collection)); @@ -81,7 +81,7 @@ namespace Robomongo QVBoxLayout *databaselayout = new QVBoxLayout(); databaselayout->setContentsMargins(0, 8, 0, 7); _databaseComboBox = new QComboBox(); - QLabel *databaseLabel = new QLabel("Select database:"); + QLabel *databaseLabel = new QLabel(tr("Select database:")); databaselayout->addWidget(databaseLabel); databaselayout->addWidget(_databaseComboBox); VERIFY(connect(_serverComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateDatabaseComboBox(int)))); diff --git a/src/robomongo/gui/dialogs/CreateDatabaseDialog.cpp b/src/robomongo/gui/dialogs/CreateDatabaseDialog.cpp index b1d3123f8..7a02c1a6d 100644 --- a/src/robomongo/gui/dialogs/CreateDatabaseDialog.cpp +++ b/src/robomongo/gui/dialogs/CreateDatabaseDialog.cpp @@ -19,7 +19,7 @@ namespace Robomongo const QString &collection, QWidget *parent) : QDialog(parent) { - setWindowTitle("Create Database"); + setWindowTitle(tr("Create Database")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?) //setFixedSize(dialogSize); setMinimumWidth(300); @@ -31,13 +31,13 @@ namespace Robomongo hline->setFrameShadow(QFrame::Sunken); _inputEdit = new QLineEdit(); - _inputLabel= new QLabel("Database Name:"); + _inputLabel= new QLabel(tr("Database Name:")); _inputEdit->setMaxLength(maxLenghtName); _buttonBox = new QDialogButtonBox(this); _buttonBox->setOrientation(Qt::Horizontal); _buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); - _buttonBox->button(QDialogButtonBox::Save)->setText("C&reate"); + _buttonBox->button(QDialogButtonBox::Save)->setText(tr("C&reate")); VERIFY(connect(_buttonBox, SIGNAL(accepted()), this, SLOT(accept()))); VERIFY(connect(_buttonBox, SIGNAL(rejected()), this, SLOT(reject()))); diff --git a/src/robomongo/gui/dialogs/CreateUserDialog.cpp b/src/robomongo/gui/dialogs/CreateUserDialog.cpp index 4b0915e5d..e5d74163c 100644 --- a/src/robomongo/gui/dialogs/CreateUserDialog.cpp +++ b/src/robomongo/gui/dialogs/CreateUserDialog.cpp @@ -46,7 +46,7 @@ namespace Robomongo { VERIFY(!user.version() < MongoUser::minimumSupportedVersion); - setWindowTitle("Add User"); + setWindowTitle(tr("Add User")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?) setMinimumSize(minimumSize); @@ -57,13 +57,13 @@ namespace Robomongo hline->setFrameShape(QFrame::HLine); hline->setFrameShadow(QFrame::Sunken); - _userNameLabel= new QLabel("Name:"); + _userNameLabel= new QLabel(tr("Name:")); _userNameEdit = new QLineEdit(); _userNameEdit->setText(QtUtils::toQString(user.name())); - _userPassLabel= new QLabel("Password:"); + _userPassLabel= new QLabel(tr("Password:")); _userPassEdit = new QLineEdit(); _userPassEdit->setEchoMode(QLineEdit::Password); - _userSourceLabel = new QLabel("UserSource:"); + _userSourceLabel = new QLabel(tr("UserSource:")); _userSourceComboBox = new QComboBox(); _userSourceComboBox->addItems(QStringList() << "" << databases); //setText(QtUtils::toQString(user.userSource())); utils::setCurrentText(_userSourceComboBox, QtUtils::toQString(user.userSource())); @@ -121,7 +121,7 @@ namespace Robomongo _user(user) { VERIFY(user.version() < MongoUser::minimumSupportedVersion); - setWindowTitle("Add User"); + setWindowTitle(tr("Add User")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); // Remove help button (?) setMinimumSize(minimumSize); @@ -132,13 +132,13 @@ namespace Robomongo hline->setFrameShape(QFrame::HLine); hline->setFrameShadow(QFrame::Sunken); - _userNameLabel= new QLabel("Name:"); + _userNameLabel= new QLabel(tr("Name:")); _userNameEdit = new QLineEdit(); _userNameEdit->setText(QtUtils::toQString(user.name())); - _userPassLabel= new QLabel("Password:"); + _userPassLabel= new QLabel(tr("Password:")); _userPassEdit = new QLineEdit(); _userPassEdit->setEchoMode(QLineEdit::Password); - _readOnlyCheckBox = new QCheckBox("Read Only"); + _readOnlyCheckBox = new QCheckBox(tr("Read Only")); _readOnlyCheckBox->setChecked(user.readOnly()); QDialogButtonBox *buttonBox = new QDialogButtonBox(this); @@ -203,7 +203,7 @@ namespace Robomongo return; if (!userSource.empty() && !pass.empty()) { - QMessageBox::warning(this, "Invalid input", "The UserSourse field and the Password field are mutually exclusive. The document cannot contain both.\n"); + QMessageBox::warning(this, tr("Invalid input"), tr("The UserSourse field and the Password field are mutually exclusive. The document cannot contain both.\n")); return; } diff --git a/src/robomongo/gui/dialogs/DocumentTextEditor.cpp b/src/robomongo/gui/dialogs/DocumentTextEditor.cpp index a8f753b8a..9253e3c3c 100644 --- a/src/robomongo/gui/dialogs/DocumentTextEditor.cpp +++ b/src/robomongo/gui/dialogs/DocumentTextEditor.cpp @@ -36,7 +36,7 @@ namespace Robomongo Indicator *databaseIndicator = new Indicator(GuiRegistry::instance().databaseIcon(), QtUtils::toQString(_info._ns.databaseName())); Indicator *serverIndicator = new Indicator(GuiRegistry::instance().serverIcon(), QtUtils::toQString(detail::prepareServerAddress(_info._serverAddress))); - QPushButton *validate = new QPushButton("Validate"); + QPushButton *validate = new QPushButton(tr("Validate")); validate->setIcon(qApp->style()->standardIcon(QStyle::SP_MessageBoxInformation)); VERIFY(connect(validate, SIGNAL(clicked()), this, SLOT(onValidateButtonClicked()))); @@ -123,17 +123,17 @@ namespace Robomongo int lineHeight = _queryText->sciScintilla()->lineLength(line); _queryText->sciScintilla()->fillIndicatorRange(line, pos, line, lineHeight, 0); - message = QString("Unable to parse JSON:
%1, at (%2, %3).") + message = tr("Unable to parse JSON:
%1, at (%2, %3).") .arg(message).arg(line + 1).arg(pos + 1); - QMessageBox::critical(NULL, "Parsing error", message); + QMessageBox::critical(NULL, tr("Parsing error"), message); _queryText->setFocus(); activateWindow(); return false; } if (!silentOnSuccess) { - QMessageBox::information(NULL, "Validation", "JSON is valid!"); + QMessageBox::information(NULL, tr("Validation"), tr("JSON is valid!")); _queryText->setFocus(); activateWindow(); } diff --git a/src/robomongo/gui/dialogs/FunctionTextEditor.cpp b/src/robomongo/gui/dialogs/FunctionTextEditor.cpp index 40e2ddad9..ea6e46e01 100644 --- a/src/robomongo/gui/dialogs/FunctionTextEditor.cpp +++ b/src/robomongo/gui/dialogs/FunctionTextEditor.cpp @@ -60,9 +60,9 @@ namespace Robomongo QVBoxLayout *layout = new QVBoxLayout(); layout->addLayout(hlayout); layout->addWidget(hline); - layout->addWidget(new QLabel("Name:")); + layout->addWidget(new QLabel(tr("Name:"))); layout->addWidget(_nameEdit); - layout->addWidget(new QLabel("Code:")); + layout->addWidget(new QLabel(tr("Code:"))); layout->addWidget(_queryText); layout->addLayout(bottomlayout); setLayout(layout); diff --git a/src/robomongo/gui/dialogs/SSHTunnelTab.cpp b/src/robomongo/gui/dialogs/SSHTunnelTab.cpp index 788a8b8a8..39767a97f 100644 --- a/src/robomongo/gui/dialogs/SSHTunnelTab.cpp +++ b/src/robomongo/gui/dialogs/SSHTunnelTab.cpp @@ -20,7 +20,7 @@ namespace Robomongo _settings(settings) { SSHInfo info = _settings->sshInfo(); - _sshSupport = new QCheckBox("Use SSH tunnel"); + _sshSupport = new QCheckBox(tr("Use SSH tunnel")); _sshSupport->setStyleSheet("margin-bottom: 7px"); _sshSupport->setChecked(info.isValid()); @@ -33,19 +33,20 @@ namespace Robomongo _sshPort->setValidator(new QRegExpValidator(rx, this)); _security = new QComboBox(); - _security->addItems(QStringList() << "Password" << "Private Key"); + _security->addItem(tr("Password"), SSHInfo::PASSWORD); + _security->addItem(tr("Private Key"), SSHInfo::PUBLICKEY); VERIFY(connect(_security, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(securityChange(const QString&)))); _passwordBox = new QLineEdit(QtUtils::toQString(info._password)); _privateKeyBox = new QLineEdit(QtUtils::toQString(info._publicKey._privateKey)); _passphraseBox = new QLineEdit(QtUtils::toQString(info._publicKey._passphrase)); - _passwordLabel = new QLabel("User Password:"); - _sshPrivateKeyLabel = new QLabel("Private key:"); - _sshPassphraseLabel = new QLabel("Passphrase:"); - _sshAddressLabel = new QLabel("SSH Address:"); - _sshUserNameLabel = new QLabel("SSH User Name:"); - _sshAuthMethodLabel = new QLabel("SSH Auth Method:"); + _passwordLabel = new QLabel(tr("User Password:")); + _sshPrivateKeyLabel = new QLabel(tr("Private key:")); + _sshPassphraseLabel = new QLabel(tr("Passphrase:")); + _sshAddressLabel = new QLabel(tr("SSH Address:")); + _sshUserNameLabel = new QLabel(tr("SSH User Name:")); + _sshAuthMethodLabel = new QLabel(tr("SSH Auth Method:")); /* // Commented because of this: @@ -98,9 +99,9 @@ namespace Robomongo setLayout(mainLayout); if (info.authMethod() == SSHInfo::PUBLICKEY) { - utils::setCurrentText(_security, "Private Key"); + utils::setCurrentText(_security, tr("Private Key")); } else { - utils::setCurrentText(_security, "Password"); + utils::setCurrentText(_security, tr("Password")); } securityChange(_security->currentText()); @@ -155,8 +156,8 @@ namespace Robomongo void SshTunelTab::setPrivateFile() { - QString filepath = QFileDialog::getOpenFileName(this, "Select private key file", - _privateKeyBox->text(), QObject::tr("Private key files (*.*)")); + QString filepath = QFileDialog::getOpenFileName(this, tr("Select private key file"), + _privateKeyBox->text(), tr("Private key files (*.*)")); if (filepath.isNull()) return; @@ -166,10 +167,7 @@ namespace Robomongo SSHInfo::SupportedAuthenticationMetods SshTunelTab::selectedAuthMethod() { - if (_security->currentText() == "Private Key") - return SSHInfo::PUBLICKEY; - - return SSHInfo::PASSWORD; + return static_cast (_security->itemData(_security->currentIndex()).toInt()); } void SshTunelTab::accept() diff --git a/src/robomongo/gui/editors/FindFrame.cpp b/src/robomongo/gui/editors/FindFrame.cpp index ab53110df..7d2dd1564 100644 --- a/src/robomongo/gui/editors/FindFrame.cpp +++ b/src/robomongo/gui/editors/FindFrame.cpp @@ -24,9 +24,9 @@ namespace Robomongo _findPanel(new QFrame(this)), _close(new QToolButton(this)), _findLine(new QLineEdit(this)), - _next(new QPushButton("Next", this)), - _prev(new QPushButton("Previous", this)), - _caseSensitive(new QCheckBox("Match case", this)), + _next(new QPushButton(tr("Next"), this)), + _prev(new QPushButton(tr("Previous"), this)), + _caseSensitive(new QCheckBox(tr("Match case"), this)), _commentSign("// "), _commentSignLength(3) { diff --git a/src/robomongo/gui/utils/DialogUtils.cpp b/src/robomongo/gui/utils/DialogUtils.cpp index 18e42950a..6ccbcf676 100644 --- a/src/robomongo/gui/utils/DialogUtils.cpp +++ b/src/robomongo/gui/utils/DialogUtils.cpp @@ -6,18 +6,20 @@ namespace Robomongo { namespace { - const QString titleTemaple = QString("%1 %2"); - const QString textTemaple = QString("%1 %3 %2?"); + //: Title for dialogs + const char* titleTemplate = QT_TRANSLATE_NOOP("Robomongo::DialogUtils", "%1 %2"); + //: Text for dialogs + const char* textTemplate = QT_TRANSLATE_NOOP("Robomongo::DialogUtils", "%1 %3 %2?"); } int questionDialog(QWidget *parent, const QString &actionText, const QString &itemText, const QString& valueText) { - return questionDialog(parent,actionText,itemText,textTemaple,valueText); + return questionDialog(parent, actionText, itemText, QApplication::translate("Robomongo::DialogUtils", textTemplate), valueText); } int questionDialog(QWidget *parent, const QString &actionText, const QString &itemText, const QString &templateText, const QString &valueText) { - return QMessageBox::question(parent,titleTemaple.arg(actionText).arg(itemText),templateText.arg(actionText).arg(itemText.toLower()).arg(valueText), QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); + return QMessageBox::question(parent, QApplication::translate("Robomongo::DialogUtils", titleTemplate).arg(actionText).arg(itemText), templateText.arg(actionText).arg(itemText.toLower()).arg(valueText), QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); } } } \ No newline at end of file diff --git a/src/robomongo/gui/utils/DialogUtils.h b/src/robomongo/gui/utils/DialogUtils.h index d8634fa6d..68d4a7533 100644 --- a/src/robomongo/gui/utils/DialogUtils.h +++ b/src/robomongo/gui/utils/DialogUtils.h @@ -1,5 +1,6 @@ #pragma once +#include #include namespace Robomongo diff --git a/src/robomongo/gui/widgets/LogWidget.cpp b/src/robomongo/gui/widgets/LogWidget.cpp index d7366fc65..7b51c4ae6 100644 --- a/src/robomongo/gui/widgets/LogWidget.cpp +++ b/src/robomongo/gui/widgets/LogWidget.cpp @@ -19,9 +19,16 @@ namespace Robomongo QHBoxLayout *hlayout = new QHBoxLayout; hlayout->setContentsMargins(0,0,0,0); hlayout->addWidget(_logTextEdit); - _clear = new QAction("Clear All", this); + _clear = new QAction(this); VERIFY(connect(_clear, SIGNAL(triggered()),_logTextEdit, SLOT(clear()))); setLayout(hlayout); + + retranslateUI(); + } + + void LogWidget::retranslateUI() + { + _clear->setText(tr("Clear All")); } void LogWidget::showContextMenu(const QPoint &pt) @@ -43,4 +50,22 @@ namespace Robomongo QScrollBar *sb = _logTextEdit->verticalScrollBar(); sb->setValue(sb->maximum()); } + + void LogWidget::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); +// Robomongo::LOG_MSG("QEvent::LanguageChange", mongo::LL_INFO); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: +// Robomongo::LOG_MSG("QEvent::LocaleChange", mongo::LL_INFO); + break; + } + } + BaseClass::changeEvent(event); + } } diff --git a/src/robomongo/gui/widgets/LogWidget.h b/src/robomongo/gui/widgets/LogWidget.h index 0a8de8ca7..700a46ed6 100644 --- a/src/robomongo/gui/widgets/LogWidget.h +++ b/src/robomongo/gui/widgets/LogWidget.h @@ -20,12 +20,17 @@ namespace Robomongo public Q_SLOTS: void addMessage(const QString &message, mongo::LogLevel level); + protected: + void changeEvent(QEvent* event); + private Q_SLOTS: void showContextMenu(const QPoint &pt); private: QTextEdit *const _logTextEdit; QAction *_clear; + + void retranslateUI(); }; } diff --git a/src/robomongo/gui/widgets/explorer/EditIndexDialog.cpp b/src/robomongo/gui/widgets/explorer/EditIndexDialog.cpp index e0ffc6f0d..6491b8d8a 100644 --- a/src/robomongo/gui/widgets/explorer/EditIndexDialog.cpp +++ b/src/robomongo/gui/widgets/explorer/EditIndexDialog.cpp @@ -77,7 +77,7 @@ namespace Robomongo EditIndexDialog::EditIndexDialog(const EnsureIndexInfo &info, const QString &databaseName, const QString &serverAdress, QWidget *parent) :BaseClass(parent),_info(info) { - setWindowTitle("Index Properties"); + setWindowTitle(tr("Index Properties")); Indicator *serverIndicator = new Indicator(GuiRegistry::instance().serverIcon(), serverAdress); Indicator *collectionIndicator = new Indicator(GuiRegistry::instance().collectionIcon(),QtUtils::toQString(_info._collection.name())); Indicator *databaseIndicator = new Indicator(GuiRegistry::instance().databaseIcon(), databaseName); @@ -125,30 +125,30 @@ namespace Robomongo uniqueStateChanged(_uniqueCheckBox->checkState()); QLabel *nameHelpLabel = createHelpLabel( - "Choose any name that will help you to identify this index.", + tr("Choose any name that will help you to identify this index."), 0, -2, 0, 15); QLabel *keyHelpLabel = createHelpLabel( - "Document that contains pairs with the name of the field or fields to index " - "and order of the index. A 1 specifies ascending and a -1 specifies descending.", + tr("Document that contains pairs with the name of the field or fields to index " + "and order of the index. A 1 specifies ascending and a -1 specifies descending."), 0, -2, 0, 20); QLabel *uniqueHelpLabel = createHelpLabel( - "If set, creates a unique index so that the collection will not accept insertion " - "of documents where the index key or keys match an existing value in the index.", + tr("If set, creates a unique index so that the collection will not accept insertion " + "of documents where the index key or keys match an existing value in the index."), 20, -2, 0, 20); QLabel *dropDupsHelpLabel = createHelpLabel( - "MongoDB cannot create a unique index on a field that has duplicate values. " + tr("MongoDB cannot create a unique index on a field that has duplicate values. " "To force the creation of a unique index, you can specify the dropDups option, " - "which will only index the first occurrence of a value for the key, and delete all subsequent values. ", + "which will only index the first occurrence of a value for the key, and delete all subsequent values. "), 20, -2, 0, 20); QGridLayout *layout = new QGridLayout; - layout->addWidget(new QLabel("Name: "), 0, 0); + layout->addWidget(new QLabel(tr("Name: ")), 0, 0); layout->addWidget(_nameLineEdit, 0, 1); layout->addWidget(nameHelpLabel, 1, 1, Qt::AlignTop); - layout->addWidget(new QLabel("Keys: "), 2, 0, Qt::AlignTop); + layout->addWidget(new QLabel(tr("Keys: ")), 2, 0, Qt::AlignTop); layout->addWidget(_jsonText, 2, 1, Qt::AlignTop); layout->addWidget(keyHelpLabel, 3, 1, Qt::AlignTop); layout->addWidget(_uniqueCheckBox, 4, 0, 1, 2); @@ -207,16 +207,16 @@ namespace Robomongo VERIFY(connect(expireCheckBox,SIGNAL(stateChanged(int)),this,SLOT(expireStateChanged(int)))); QLabel *sparseHelpLabel = createHelpLabel( - "If set, the index only references documents with the specified field. " - "These indexes use less space but behave differently in some situations (particularly sorts).", + tr("If set, the index only references documents with the specified field. " + "These indexes use less space but behave differently in some situations (particularly sorts)."), 20, -2, 0, 20); QLabel *backgroundHelpLabel = createHelpLabel( - "Builds the index in the background so that building an index does not block other database activities.", + tr("Builds the index in the background so that building an index does not block other database activities."), 20, -2, 0, 20); QLabel *expireHelpLabel = createHelpLabel( - "Specifies a time to live, in seconds, to control how long MongoDB retains documents in this collection", + tr("Specifies a time to live, in seconds, to control how long MongoDB retains documents in this collection"), 20, -2, 0, 20); QGridLayout *layout = new QGridLayout; @@ -242,16 +242,16 @@ namespace Robomongo _textWeightsLineEdit = createFindFrame(textSearch, QtUtils::toQString(_info._textWeights)); QLabel *defaultLanguageHelpLabel = createHelpLabel( - "For a text index, the language that determines the list of stop words and the rules for the stemmer and tokenizer. The default value is english", + tr("For a text index, the language that determines the list of stop words and the rules for the stemmer and tokenizer. The default value is english"), 0, -2, 0, 20); QLabel *languageOverrideHelpLabel = createHelpLabel( - "For a text index, specify the name of the field in the document that contains, for that document, the language to override the default language. The default value is language", + tr("For a text index, specify the name of the field in the document that contains, for that document, the language to override the default language. The default value is language"), 0, -2, 0, 20); QLabel *textWeightsHelpLabel = createHelpLabel( - "Document that contains field and weight pairs. The weight is a number ranging from 1 to 99,999 " - "and denotes the significance of the field relative to the other indexed fields. ", + tr("Document that contains field and weight pairs. The weight is a number ranging from 1 to 99,999 " + "and denotes the significance of the field relative to the other indexed fields. "), 0, -2, 0, 20); QGridLayout *layout = new QGridLayout; @@ -298,14 +298,14 @@ namespace Robomongo if (isValidJson(_jsonText->sciScintilla()->text())) { const QString &weightText = _textWeightsLineEdit->sciScintilla()->text(); if (!weightText.isEmpty() && !isValidJson(weightText)) { - QMessageBox::warning(this, "Invalid json", "Please check json text.\n"); + QMessageBox::warning(this, tr("Invalid json"), tr("Please check json text.\n")); _textWeightsLineEdit->setFocus(); return ; } return BaseClass::accept(); } else { - QMessageBox::warning(this, "Invalid json", "Please check json text.\n"); + QMessageBox::warning(this, tr("Invalid json"), tr("Please check json text.\n")); _jsonText->setFocus(); } } diff --git a/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.cpp b/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.cpp index c5469636c..516646d78 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.cpp +++ b/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.cpp @@ -38,37 +38,49 @@ namespace Robomongo ExplorerCollectionDirIndexesTreeItem::ExplorerCollectionDirIndexesTreeItem(QTreeWidgetItem *parent) :BaseClass(parent) { - QAction *addIndex = new QAction("Add Index...", this); - VERIFY(connect(addIndex, SIGNAL(triggered()), SLOT(ui_addIndex()))); + _addIndexAction = new QAction(this); + VERIFY(connect(_addIndexAction, SIGNAL(triggered()), SLOT(ui_addIndex()))); - QAction *addIndexGui = new QAction("Add Index...", this); - VERIFY(connect(addIndexGui, SIGNAL(triggered()), SLOT(ui_addIndexGui()))); + _addIndexGuiAction = new QAction(this); + VERIFY(connect(_addIndexGuiAction, SIGNAL(triggered()), SLOT(ui_addIndexGui()))); - QAction *dropIndex = new QAction("Drop Index...", this); - VERIFY(connect(dropIndex, SIGNAL(triggered()), SLOT(ui_dropIndex()))); + _dropIndexAction = new QAction(this); + VERIFY(connect(_dropIndexAction, SIGNAL(triggered()), SLOT(ui_dropIndex()))); - QAction *reIndex = new QAction("Rebuild Indexes...", this); - VERIFY(connect(reIndex, SIGNAL(triggered()), SLOT(ui_reIndex()))); + _reIndexAction = new QAction(this); + VERIFY(connect(_reIndexAction, SIGNAL(triggered()), SLOT(ui_reIndex()))); - QAction *viewIndex = new QAction("View Indexes", this); - VERIFY(connect(viewIndex, SIGNAL(triggered()), SLOT(ui_viewIndex()))); + _viewIndexAction = new QAction(this); + VERIFY(connect(_viewIndexAction, SIGNAL(triggered()), SLOT(ui_viewIndex()))); - QAction *refreshIndex = new QAction("Refresh", this); - VERIFY(connect(refreshIndex, SIGNAL(triggered()), SLOT(ui_refreshIndex()))); + _refreshIndexAction = new QAction(this); + VERIFY(connect(_refreshIndexAction, SIGNAL(triggered()), SLOT(ui_refreshIndex()))); - BaseClass::_contextMenu->addAction(viewIndex); + BaseClass::_contextMenu->addAction(_viewIndexAction); //BaseClass::_contextMenu->addAction(addIndex); - BaseClass::_contextMenu->addAction(addIndexGui); + BaseClass::_contextMenu->addAction(_addIndexGuiAction); //BaseClass::_contextMenu->addAction(dropIndex); - BaseClass::_contextMenu->addAction(reIndex); + BaseClass::_contextMenu->addAction(_reIndexAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(refreshIndex); + BaseClass::_contextMenu->addAction(_refreshIndexAction); - setText(0, labelText); setIcon(0, Robomongo::GuiRegistry::instance().folderIcon()); setExpanded(false); setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); + + retranslateUI(); + } + + void ExplorerCollectionDirIndexesTreeItem::retranslateUI() + { + _addIndexAction->setText(tr("Add Index...")); + _addIndexGuiAction->setText(tr("Add Index...")); + _dropIndexAction->setText(tr("Drop Index...")); + _reIndexAction->setText(tr("Rebuild Indexes...")); + _viewIndexAction->setText(tr("View Indexes")); + _refreshIndexAction->setText(tr("Refresh")); + setText(0, tr("Indexes")); } void ExplorerCollectionDirIndexesTreeItem::expand() @@ -104,9 +116,9 @@ namespace Robomongo "ensureIndex({ \"\" : 1 }); \n" "\n" "// options: \n" - "// { unique : true } - A unique index causes MongoDB to reject all documents that contain a duplicate value for the indexed field. \n" - "// { sparse : true } - Sparse indexes only contain entries for documents that have the indexed field. \n" - "// { dropDups : true } - Sparse indexes only contain entries for documents that have the indexed field. \n" + "// { unique : true } - " + tr("A unique index causes MongoDB to reject all documents that contain a duplicate value for the indexed field.") + " \n" + "// { sparse : true } - " + tr("Sparse indexes only contain entries for documents that have the indexed field.") + " \n" + "// { dropDups : true } - " + tr("") + "http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping \n" , false); } } @@ -148,22 +160,30 @@ namespace Robomongo ExplorerCollectionIndexesTreeItem::ExplorerCollectionIndexesTreeItem(ExplorerCollectionDirIndexesTreeItem *parent,const EnsureIndexInfo &info) : BaseClass(parent),_info(info) { - QAction *deleteIndex = new QAction("Drop Index...", this); - connect(deleteIndex, SIGNAL(triggered()), SLOT(ui_dropIndex())); - QAction *editIndex = new QAction("Edit Index...", this); - connect(editIndex, SIGNAL(triggered()), SLOT(ui_edit())); + _deleteIndexAction = new QAction(this); + connect(_deleteIndexAction, SIGNAL(triggered()), SLOT(ui_dropIndex())); + _editIndexAction = new QAction(this); + connect(_editIndexAction, SIGNAL(triggered()), SLOT(ui_edit())); - BaseClass::_contextMenu->addAction(editIndex); - BaseClass::_contextMenu->addAction(deleteIndex); + BaseClass::_contextMenu->addAction(_editIndexAction); + BaseClass::_contextMenu->addAction(_deleteIndexAction); setText(0, QtUtils::toQString(_info._name)); setIcon(0, Robomongo::GuiRegistry::instance().indexIcon()); + + retranslateUI(); + } + + void ExplorerCollectionIndexesTreeItem::retranslateUI() + { + _deleteIndexAction->setText(tr("Drop Index...")); + _editIndexAction->setText(tr("Edit Index...")); } void ExplorerCollectionIndexesTreeItem::ui_dropIndex() { // Ask user - int answer = utils::questionDialog(treeWidget(),"Drop","Index",text(0)); + int answer = utils::questionDialog(treeWidget(),tr("Drop"),tr("Index"),text(0)); if (answer != QMessageBox::Yes) return; @@ -203,63 +223,59 @@ namespace Robomongo ExplorerCollectionTreeItem::ExplorerCollectionTreeItem(QTreeWidgetItem *parent, ExplorerDatabaseTreeItem *databaseItem, MongoCollection *collection) : BaseClass(parent), _collection(collection), _databaseItem(databaseItem) { - QAction *addDocument = new QAction("Insert Document...", this); - VERIFY(connect(addDocument, SIGNAL(triggered()), SLOT(ui_addDocument()))); - - QAction *updateDocument = new QAction("Update Documents...", this); - VERIFY(connect(updateDocument, SIGNAL(triggered()), SLOT(ui_updateDocument()))); - QAction *removeDocument = new QAction("Remove Documents...", this); - VERIFY(connect(removeDocument, SIGNAL(triggered()), SLOT(ui_removeDocument()))); - - QAction *removeAllDocuments = new QAction("Remove All Documents...", this); - VERIFY(connect(removeAllDocuments, SIGNAL(triggered()), SLOT(ui_removeAllDocuments()))); - - QAction *collectionStats = new QAction("Statistics", this); - VERIFY(connect(collectionStats, SIGNAL(triggered()), SLOT(ui_collectionStatistics()))); - - QAction *storageSize = new QAction("Storage Size", this); - VERIFY(connect(storageSize, SIGNAL(triggered()), SLOT(ui_storageSize()))); + _addDocumentAction = new QAction(this); + VERIFY(connect(_addDocumentAction, SIGNAL(triggered()), SLOT(ui_addDocument()))); - QAction *totalIndexSize = new QAction("Total Index Size", this); - VERIFY(connect(totalIndexSize, SIGNAL(triggered()), SLOT(ui_totalIndexSize()))); - - QAction *totalSize = new QAction("Total Size", this); - VERIFY(connect(totalSize, SIGNAL(triggered()), SLOT(ui_totalSize()))); - QAction *shardVersion = new QAction("Shard Version", this); - VERIFY(connect(shardVersion, SIGNAL(triggered()), SLOT(ui_shardVersion()))); - - QAction *shardDistribution = new QAction("Shard Distribution", this); - VERIFY(connect(shardDistribution, SIGNAL(triggered()), SLOT(ui_shardDistribution()))); - - QAction *dropCollection = new QAction("Drop Collection...", this); - VERIFY(connect(dropCollection, SIGNAL(triggered()), SLOT(ui_dropCollection()))); - - QAction *renameCollection = new QAction("Rename Collection...", this); - VERIFY(connect(renameCollection, SIGNAL(triggered()), SLOT(ui_renameCollection()))); - QAction *duplicateCollection = new QAction("Duplicate Collection...", this); - VERIFY(connect(duplicateCollection, SIGNAL(triggered()), SLOT(ui_duplicateCollection()))); - QAction *copyCollectionToDiffrentServer = new QAction("Copy Collection to Database...", this); - VERIFY(connect(copyCollectionToDiffrentServer, SIGNAL(triggered()), SLOT(ui_copyToCollectionToDiffrentServer()))); - - QAction *viewCollection = new QAction("View Documents", this); - VERIFY(connect(viewCollection, SIGNAL(triggered()), SLOT(ui_viewCollection()))); - - BaseClass::_contextMenu->addAction(viewCollection); + _updateDocumentAction = new QAction(this); + VERIFY(connect(_updateDocumentAction, SIGNAL(triggered()), SLOT(ui_updateDocument()))); + + _removeDocumentAction = new QAction(this); + VERIFY(connect(_removeDocumentAction, SIGNAL(triggered()), SLOT(ui_removeDocument()))); + _removeAllDocumentsAction = new QAction(this); + VERIFY(connect(_removeAllDocumentsAction, SIGNAL(triggered()), SLOT(ui_removeAllDocuments()))); + + _collectionStatsAction = new QAction(this); + VERIFY(connect(_collectionStatsAction, SIGNAL(triggered()), SLOT(ui_collectionStatistics()))); + + _storageSizeAction = new QAction(this); + VERIFY(connect(_storageSizeAction, SIGNAL(triggered()), SLOT(ui_storageSize()))); + _totalIndexSizeAction = new QAction(this); + VERIFY(connect(_totalIndexSizeAction, SIGNAL(triggered()), SLOT(ui_totalIndexSize()))); + _totalSizeAction = new QAction(this); + VERIFY(connect(_totalSizeAction, SIGNAL(triggered()), SLOT(ui_totalSize()))); + + _shardVersionAction = new QAction(this); + VERIFY(connect(_shardVersionAction, SIGNAL(triggered()), SLOT(ui_shardVersion()))); + _shardDistributionAction = new QAction(this); + VERIFY(connect(_shardDistributionAction, SIGNAL(triggered()), SLOT(ui_shardDistribution()))); + + _dropCollectionAction = new QAction(this); + VERIFY(connect(_dropCollectionAction, SIGNAL(triggered()), SLOT(ui_dropCollection()))); + _renameCollectionAction = new QAction(this); + VERIFY(connect(_renameCollectionAction, SIGNAL(triggered()), SLOT(ui_renameCollection()))); + _duplicateCollectionAction = new QAction(this); + VERIFY(connect(_duplicateCollectionAction, SIGNAL(triggered()), SLOT(ui_duplicateCollection()))); + _copyCollectionToDiffrentServerAction = new QAction(this); + VERIFY(connect(_copyCollectionToDiffrentServerAction, SIGNAL(triggered()), SLOT(ui_copyToCollectionToDiffrentServer()))); + _viewCollectionAction = new QAction(this); + VERIFY(connect(_viewCollectionAction, SIGNAL(triggered()), SLOT(ui_viewCollection()))); + + BaseClass::_contextMenu->addAction(_viewCollectionAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(addDocument); - BaseClass::_contextMenu->addAction(updateDocument); - BaseClass::_contextMenu->addAction(removeDocument); - BaseClass::_contextMenu->addAction(removeAllDocuments); + BaseClass::_contextMenu->addAction(_addDocumentAction); + BaseClass::_contextMenu->addAction(_updateDocumentAction); + BaseClass::_contextMenu->addAction(_removeDocumentAction); + BaseClass::_contextMenu->addAction(_removeAllDocumentsAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(renameCollection); - BaseClass::_contextMenu->addAction(duplicateCollection); - BaseClass::_contextMenu->addAction(copyCollectionToDiffrentServer); - BaseClass::_contextMenu->addAction(dropCollection); + BaseClass::_contextMenu->addAction(_renameCollectionAction); + BaseClass::_contextMenu->addAction(_duplicateCollectionAction); + BaseClass::_contextMenu->addAction(_copyCollectionToDiffrentServerAction); + BaseClass::_contextMenu->addAction(_dropCollectionAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(collectionStats); + BaseClass::_contextMenu->addAction(_collectionStatsAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(shardVersion); - BaseClass::_contextMenu->addAction(shardDistribution); + BaseClass::_contextMenu->addAction(_shardVersionAction); + BaseClass::_contextMenu->addAction(_shardDistributionAction); AppRegistry::instance().bus()->subscribe(_databaseItem, LoadCollectionIndexesResponse::Type, this); AppRegistry::instance().bus()->subscribe(_databaseItem, DeleteCollectionIndexResponse::Type, this); @@ -274,6 +290,27 @@ namespace Robomongo setExpanded(false); setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); + + retranslateUI(); + } + + void ExplorerCollectionTreeItem::retranslateUI() + { + _addDocumentAction->setText(tr("Insert Document...")); + _updateDocumentAction->setText(tr("Update Documents...")); + _removeDocumentAction->setText(tr("Remove Documents...")); + _removeAllDocumentsAction->setText(tr("Remove All Documents...")); + _collectionStatsAction->setText(tr("Statistics")); + _storageSizeAction->setText(tr("Storage Size")); + _totalIndexSizeAction->setText(tr("Total Index Size")); + _totalSizeAction->setText(tr("Total Size")); + _shardVersionAction->setText(tr("Shard Version")); + _shardDistributionAction->setText(tr("Shard Distribution")); + _dropCollectionAction->setText(tr("Drop Collection...")); + _renameCollectionAction->setText(tr("Rename Collection...")); + _duplicateCollectionAction->setText(tr("Duplicate Collection...")); + _copyCollectionToDiffrentServerAction->setText(tr("Copy Collection to Database...")); + _viewCollectionAction->setText(tr("View Documents")); } void ExplorerCollectionTreeItem::handle(LoadCollectionIndexesResponse *event) @@ -340,7 +377,7 @@ namespace Robomongo DocumentTextEditor editor(CollectionInfo(settings->getFullAddress(), database->name(), _collection->name()), "{\n \n}"); editor.setCursorPosition(1, 4); - editor.setWindowTitle("Insert Document"); + editor.setWindowTitle(tr("Insert Document")); int result = editor.exec(); treeWidget()->activateWindow(); @@ -362,8 +399,8 @@ namespace Robomongo MongoDatabase *database = _collection->database(); // Ask user int answer = QMessageBox::question(treeWidget(), - "Remove All Documents", - QString("Remove all documents from %1 collection?").arg(QtUtils::toQString(_collection->name())), + tr("Remove All Documents"), + tr("Remove all documents from %1 collection?").arg(QtUtils::toQString(_collection->name())), QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); if (answer == QMessageBox::Yes) { @@ -390,8 +427,8 @@ namespace Robomongo " \n" " // options \n" " {\n" - " \"multi\" : false, // update only one document \n" - " \"upsert\" : false // insert a new document, if no existing document match the query \n" + " \"multi\" : false, // " + tr("update only one document") + " \n" + " \"upsert\" : false // " + tr("insert a new document, if no existing document match the query") + " \n" " }\n" ");", false); } @@ -404,7 +441,7 @@ namespace Robomongo void ExplorerCollectionTreeItem::ui_dropCollection() { // Ask user - int answer = utils::questionDialog(treeWidget(),"Drop","collection",QtUtils::toQString(_collection->name())); + int answer = utils::questionDialog(treeWidget(),tr("Drop"),tr("collection"),QtUtils::toQString(_collection->name())); if (answer == QMessageBox::Yes) { MongoDatabase *database = _collection->database(); @@ -422,9 +459,9 @@ namespace Robomongo CreateDatabaseDialog dlg(QtUtils::toQString(settings->getFullAddress()), QtUtils::toQString(database->name()), QtUtils::toQString(_collection->name()), treeWidget()); - dlg.setWindowTitle("Duplicate Collection"); - dlg.setOkButtonText("&Duplicate"); - dlg.setInputLabelText("New Collection Name:"); + dlg.setWindowTitle(tr("Duplicate Collection")); + dlg.setOkButtonText(tr("&Duplicate")); + dlg.setInputLabelText(tr("New Collection Name:")); dlg.setInputText(QtUtils::toQString(_collection->name() + "_copy")); int result = dlg.exec(); @@ -461,9 +498,9 @@ namespace Robomongo CreateDatabaseDialog dlg(QtUtils::toQString(settings->getFullAddress()), QtUtils::toQString(database->name()), QtUtils::toQString(_collection->name()), treeWidget()); - dlg.setWindowTitle("Rename Collection"); - dlg.setOkButtonText("&Rename"); - dlg.setInputLabelText("New Collection Name:"); + dlg.setWindowTitle(tr("Rename Collection")); + dlg.setOkButtonText(tr("&Rename")); + dlg.setInputLabelText(tr("New Collection Name:")); dlg.setInputText(QtUtils::toQString(_collection->name())); int result = dlg.exec(); diff --git a/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.h b/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.h index 138e7c461..a623e3d74 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerCollectionTreeItem.h @@ -30,6 +30,7 @@ namespace Robomongo void dropIndex(const QTreeWidgetItem * const ind); void openCurrentCollectionShell(const QString &script, bool execute = true, const CursorPosition &cursor = CursorPosition()); ExplorerDatabaseTreeItem *const databaseItem() const { return _databaseItem; } + void retranslateUI(); public Q_SLOTS: void handle(LoadCollectionIndexesResponse *event); @@ -58,6 +59,22 @@ namespace Robomongo ExplorerCollectionDirIndexesTreeItem *_indexDir; MongoCollection *const _collection; ExplorerDatabaseTreeItem *const _databaseItem; + + QAction *_addDocumentAction; + QAction *_updateDocumentAction; + QAction *_removeDocumentAction; + QAction *_removeAllDocumentsAction; + QAction *_collectionStatsAction; + QAction *_storageSizeAction; + QAction *_totalIndexSizeAction; + QAction *_totalSizeAction; + QAction *_shardVersionAction; + QAction *_shardDistributionAction; + QAction *_dropCollectionAction; + QAction *_renameCollectionAction; + QAction *_duplicateCollectionAction; + QAction *_copyCollectionToDiffrentServerAction; + QAction *_viewCollectionAction; }; class ExplorerCollectionDirIndexesTreeItem: public ExplorerTreeItem @@ -68,6 +85,7 @@ namespace Robomongo static const QString labelText; explicit ExplorerCollectionDirIndexesTreeItem(QTreeWidgetItem *parent); void expand(); + void retranslateUI(); private Q_SLOTS: void ui_addIndex(); @@ -76,6 +94,15 @@ namespace Robomongo void ui_dropIndex(); void ui_viewIndex(); void ui_refreshIndex(); + + private: + QAction *_addIndexAction; + QAction *_addIndexGuiAction; + QAction *_dropIndexAction; + QAction *_reIndexAction; + QAction *_viewIndexAction; + QAction *_refreshIndexAction; + }; class ExplorerCollectionIndexesTreeItem: public ExplorerTreeItem @@ -84,11 +111,15 @@ namespace Robomongo public: typedef ExplorerTreeItem BaseClass; explicit ExplorerCollectionIndexesTreeItem(ExplorerCollectionDirIndexesTreeItem *parent,const EnsureIndexInfo &info); + void retranslateUI(); private Q_SLOTS: void ui_dropIndex(); void ui_edit(); private: EnsureIndexInfo _info; + + QAction *_deleteIndexAction; + QAction *_editIndexAction; }; } diff --git a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.cpp b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.cpp index a77cf72b3..f70ae5d1e 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.cpp +++ b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.cpp @@ -30,55 +30,76 @@ namespace Robomongo BaseClass(databaseItem) ,_category(category) { if (_category == Collections) { - QAction *createCollection = new QAction("Create Collection...", this); - VERIFY(connect(createCollection, SIGNAL(triggered()), SLOT(ui_createCollection()))); + _createCollectionAction = new QAction(this); + VERIFY(connect(_createCollectionAction, SIGNAL(triggered()), SLOT(ui_createCollection()))); - QAction *dbCollectionsStats = new QAction("Collections Statistics", this); - VERIFY(connect(dbCollectionsStats, SIGNAL(triggered()), SLOT(ui_dbCollectionsStatistics()))); + _dbCollectionsStatsAction = new QAction(this); + VERIFY(connect(_dbCollectionsStatsAction, SIGNAL(triggered()), SLOT(ui_dbCollectionsStatistics()))); - QAction *refreshCollections = new QAction("Refresh", this); - VERIFY(connect(refreshCollections, SIGNAL(triggered()), SLOT(ui_refreshCollections()))); + _refreshCollectionsAction = new QAction(this); + VERIFY(connect(_refreshCollectionsAction, SIGNAL(triggered()), SLOT(ui_refreshCollections()))); - BaseClass::_contextMenu->addAction(dbCollectionsStats); - BaseClass::_contextMenu->addAction(createCollection); + BaseClass::_contextMenu->addAction(_dbCollectionsStatsAction); + BaseClass::_contextMenu->addAction(_createCollectionAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(refreshCollections); + BaseClass::_contextMenu->addAction(_refreshCollectionsAction); } else if (_category == Users) { - QAction *refreshUsers = new QAction("Refresh", this); - VERIFY(connect(refreshUsers, SIGNAL(triggered()), SLOT(ui_refreshUsers()))); + _refreshUsersAction = new QAction(this); + VERIFY(connect(_refreshUsersAction, SIGNAL(triggered()), SLOT(ui_refreshUsers()))); - QAction *viewUsers = new QAction("View Users", this); - VERIFY(connect(viewUsers, SIGNAL(triggered()), SLOT(ui_viewUsers()))); + _viewUsersAction = new QAction(this); + VERIFY(connect(_viewUsersAction, SIGNAL(triggered()), SLOT(ui_viewUsers()))); - QAction *addUser = new QAction("Add User...", this); - VERIFY(connect(addUser, SIGNAL(triggered()), SLOT(ui_addUser()))); + _addUserAction = new QAction(this); + VERIFY(connect(_addUserAction, SIGNAL(triggered()), SLOT(ui_addUser()))); - BaseClass::_contextMenu->addAction(viewUsers); - BaseClass::_contextMenu->addAction(addUser); + BaseClass::_contextMenu->addAction(_viewUsersAction); + BaseClass::_contextMenu->addAction(_addUserAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(refreshUsers); + BaseClass::_contextMenu->addAction(_refreshUsersAction); } else if (_category == Functions) { - QAction *refreshFunctions = new QAction("Refresh", this); - VERIFY(connect(refreshFunctions, SIGNAL(triggered()), SLOT(ui_refreshFunctions()))); + _refreshFunctionsAction = new QAction(this); + VERIFY(connect(_refreshFunctionsAction, SIGNAL(triggered()), SLOT(ui_refreshFunctions()))); - QAction *viewFunctions = new QAction("View Functions", this); - VERIFY(connect(viewFunctions, SIGNAL(triggered()), SLOT(ui_viewFunctions()))); + _viewFunctionsAction = new QAction(this); + VERIFY(connect(_viewFunctionsAction, SIGNAL(triggered()), SLOT(ui_viewFunctions()))); - QAction *addFunction = new QAction("Add Function...", this); - VERIFY(connect(addFunction, SIGNAL(triggered()), SLOT(ui_addFunction()))); + _addFunctionAction = new QAction(this); + VERIFY(connect(_addFunctionAction, SIGNAL(triggered()), SLOT(ui_addFunction()))); - BaseClass::_contextMenu->addAction(viewFunctions); - BaseClass::_contextMenu->addAction(addFunction); + BaseClass::_contextMenu->addAction(_viewFunctionsAction); + BaseClass::_contextMenu->addAction(_addFunctionAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(refreshFunctions); + BaseClass::_contextMenu->addAction(_refreshFunctionsAction); } setExpanded(false); setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); + + retranslateUI(); + } + + void ExplorerDatabaseCategoryTreeItem::retranslateUI() + { + if (_category == Collections) { + _createCollectionAction->setText(tr("Create Collection...")); + _dbCollectionsStatsAction->setText(tr("Collections Statistics")); + _refreshCollectionsAction->setText(tr("Refresh")); + } + else if (_category == Users) { + _refreshUsersAction->setText(tr("Refresh")); + _viewUsersAction->setText(tr("View Users")); + _addUserAction->setText(tr("Add User...")); + } + else if (_category == Functions) { + _refreshFunctionsAction->setText(tr("Refresh")); + _viewFunctionsAction->setText(tr("View Functions")); + _addFunctionAction->setText(tr("Add Function...")); + } } void ExplorerDatabaseCategoryTreeItem::expand() @@ -155,9 +176,9 @@ namespace Robomongo CreateDatabaseDialog dlg(QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()), QtUtils::toQString(databaseItem->database()->name()), QString(), treeWidget()); - dlg.setWindowTitle("Create Collection"); - dlg.setOkButtonText("&Create"); - dlg.setInputLabelText("Collection Name:"); + dlg.setWindowTitle(tr("Create Collection")); + dlg.setOkButtonText(tr("&Create")); + dlg.setInputLabelText(tr("Collection Name:")); int result = dlg.exec(); if (result != QDialog::Accepted) return; @@ -202,10 +223,10 @@ namespace Robomongo return; FunctionTextEditor dlg(QtUtils::toQString(databaseItem->database()->server()->connectionRecord()->getFullAddress()), QtUtils::toQString(databaseItem->database()->name()), MongoFunction()); - dlg.setWindowTitle("Create Function"); + dlg.setWindowTitle(tr("Create Function")); dlg.setCode( "function() {\n" - " // write your code here\n" + " // " + tr("write your code here") + "\n" "}"); dlg.setCursorPosition(1, 4); int result = dlg.exec(); diff --git a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.h b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.h index 20dad37ed..e20f2367b 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseCategoryTreeItem.h @@ -24,6 +24,7 @@ namespace Robomongo typedef ExplorerTreeItem BaseClass; ExplorerDatabaseCategoryTreeItem(ExplorerDatabaseTreeItem *databaseItem,ExplorerDatabaseCategory category); void expand(); + void retranslateUI(); private Q_SLOTS: void ui_createCollection(); @@ -39,5 +40,17 @@ namespace Robomongo private: ExplorerDatabaseTreeItem *databaseItem() const; const ExplorerDatabaseCategory _category; + + QAction *_createCollectionAction; + QAction *_dbCollectionsStatsAction; + QAction *_refreshCollectionsAction; + + QAction *_refreshUsersAction; + QAction *_viewUsersAction; + QAction *_addUserAction; + + QAction *_refreshFunctionsAction; + QAction *_viewFunctionsAction; + QAction *_addFunctionAction; }; } diff --git a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.cpp b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.cpp index 8854b4daa..934d42df2 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.cpp +++ b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.cpp @@ -1,7 +1,6 @@ #include "robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.h" #include -#include #include #include "robomongo/core/domain/MongoDatabase.h" @@ -48,29 +47,29 @@ namespace Robomongo _bus(AppRegistry::instance().bus()), _collectionSystemFolderItem(NULL) { - QAction *openDbShellAction = new QAction("Open Shell", this); - openDbShellAction->setIcon(GuiRegistry::instance().mongodbIcon()); - VERIFY(connect(openDbShellAction, SIGNAL(triggered()), SLOT(ui_dbOpenShell()))); + _openDbShellAction = new QAction(this); + _openDbShellAction->setIcon(GuiRegistry::instance().mongodbIcon()); + VERIFY(connect(_openDbShellAction, SIGNAL(triggered()), SLOT(ui_dbOpenShell()))); - QAction *dbStats = new QAction("Database Statistics", this); - VERIFY(connect(dbStats, SIGNAL(triggered()), SLOT(ui_dbStatistics()))); + _dbStatsAction = new QAction(this); + VERIFY(connect(_dbStatsAction, SIGNAL(triggered()), SLOT(ui_dbStatistics()))); - QAction *dbDrop = new QAction("Drop Database..", this); - VERIFY(connect(dbDrop, SIGNAL(triggered()), SLOT(ui_dbDrop()))); + _dbDropAction = new QAction(this); + VERIFY(connect(_dbDropAction, SIGNAL(triggered()), SLOT(ui_dbDrop()))); - QAction *dbRepair = new QAction("Repair Database...", this); - VERIFY(connect(dbRepair, SIGNAL(triggered()), SLOT(ui_dbRepair()))); + _dbRepairAction = new QAction(this); + VERIFY(connect(_dbRepairAction, SIGNAL(triggered()), SLOT(ui_dbRepair()))); - QAction *refreshDatabase = new QAction("Refresh", this); - VERIFY(connect(refreshDatabase, SIGNAL(triggered()), SLOT(ui_refreshDatabase()))); + _refreshDatabaseAction = new QAction(this); + VERIFY(connect(_refreshDatabaseAction, SIGNAL(triggered()), SLOT(ui_refreshDatabase()))); - BaseClass::_contextMenu->addAction(openDbShellAction); - BaseClass::_contextMenu->addAction(refreshDatabase); + BaseClass::_contextMenu->addAction(_openDbShellAction); + BaseClass::_contextMenu->addAction(_refreshDatabaseAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(dbStats); + BaseClass::_contextMenu->addAction(_dbStatsAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(dbRepair); - BaseClass::_contextMenu->addAction(dbDrop); + BaseClass::_contextMenu->addAction(_dbRepairAction); + BaseClass::_contextMenu->addAction(_dbDropAction); _bus->subscribe(this, MongoDatabaseCollectionListLoadedEvent::Type, _database); _bus->subscribe(this, MongoDatabaseUsersLoadedEvent::Type, _database); @@ -85,19 +84,31 @@ namespace Robomongo setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); _collectionFolderItem = new ExplorerDatabaseCategoryTreeItem(this,Collections); - _collectionFolderItem->setText(0, "Collections"); _collectionFolderItem->setIcon(0, GuiRegistry::instance().folderIcon()); addChild(_collectionFolderItem); _javascriptFolderItem = new ExplorerDatabaseCategoryTreeItem(this,Functions); - _javascriptFolderItem->setText(0, "Functions"); _javascriptFolderItem->setIcon(0, GuiRegistry::instance().folderIcon()); addChild(_javascriptFolderItem); _usersFolderItem = new ExplorerDatabaseCategoryTreeItem(this,Users); - _usersFolderItem->setText(0, "Users"); _usersFolderItem->setIcon(0, GuiRegistry::instance().folderIcon()); addChild(_usersFolderItem); + + retranslateUI(); + } + + void ExplorerDatabaseTreeItem::retranslateUI() + { + _openDbShellAction->setText(tr("Open Shell")); + _dbStatsAction->setText(tr("Database Statistics")); + _dbDropAction->setText(tr("Drop Database...")); + _dbRepairAction->setText(tr("Repair Database...")); + _refreshDatabaseAction->setText(tr("Refresh")); + + _collectionFolderItem->setText(0, tr("Collections")); + _javascriptFolderItem->setText(0, tr("Functions")); + _usersFolderItem->setText(0, tr("Users")); } void ExplorerDatabaseTreeItem::expandCollections() @@ -139,12 +150,12 @@ namespace Robomongo { std::vector collections = event->collections; int count = collections.size(); - _collectionFolderItem->setText(0, detail::buildName("Collections",count)); + _collectionFolderItem->setText(0, detail::buildName(tr("Collections"),count)); QtUtils::clearChildItems(_collectionFolderItem); _collectionSystemFolderItem = new ExplorerTreeItem(_collectionFolderItem); _collectionSystemFolderItem->setIcon(0, GuiRegistry::instance().folderIcon()); - _collectionSystemFolderItem->setText(0, "System"); + _collectionSystemFolderItem->setText(0, tr("System")); _collectionFolderItem->addChild(_collectionSystemFolderItem); for (int i = 0; i < collections.size(); ++i) { @@ -164,7 +175,7 @@ namespace Robomongo { std::vector users = event->users(); int count = users.size(); - _usersFolderItem->setText(0, detail::buildName("Users",count)); + _usersFolderItem->setText(0, detail::buildName(tr("Users"),count)); QtUtils::clearChildItems(_usersFolderItem); @@ -178,7 +189,7 @@ namespace Robomongo { std::vector functions = event->functions(); int count = functions.size(); - _javascriptFolderItem->setText(0, detail::buildName("Functions",count)); + _javascriptFolderItem->setText(0, detail::buildName(tr("Functions"),count)); QtUtils::clearChildItems(_javascriptFolderItem); @@ -190,17 +201,17 @@ namespace Robomongo void ExplorerDatabaseTreeItem::handle(MongoDatabaseCollectionsLoadingEvent *event) { - _collectionFolderItem->setText(0, detail::buildName("Collections",-1)); + _collectionFolderItem->setText(0, detail::buildName(tr("Collections"),-1)); } void ExplorerDatabaseTreeItem::handle(MongoDatabaseFunctionsLoadingEvent *event) { - _javascriptFolderItem->setText(0, detail::buildName("Functions",-1)); + _javascriptFolderItem->setText(0, detail::buildName(tr("Functions"),-1)); } void ExplorerDatabaseTreeItem::handle(MongoDatabaseUsersLoadingEvent *event) { - _usersFolderItem->setText(0, detail::buildName("Users",-1)); + _usersFolderItem->setText(0, detail::buildName(tr("Users"),-1)); } void ExplorerDatabaseTreeItem::addCollectionItem(MongoCollection *collection) @@ -245,9 +256,9 @@ namespace Robomongo void ExplorerDatabaseTreeItem::ui_dbDrop() { // Ask user - QString buff = QString("Drop %1 database?").arg(QtUtils::toQString(_database->name())); + QString buff = tr("Drop %1 database?").arg(QtUtils::toQString(_database->name())); int answer = QMessageBox::question(treeWidget(), - "Drop Database",buff, + tr("Drop Database"),buff, QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); if (answer != QMessageBox::Yes) return; diff --git a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.h b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.h index cad96203a..5e2e07dd7 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerDatabaseTreeItem.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "robomongo/gui/widgets/explorer/ExplorerTreeItem.h" namespace Robomongo @@ -40,6 +42,7 @@ namespace Robomongo void dropIndexFromCollection(ExplorerCollectionTreeItem *const item, const std::string &indexName); void enshureIndex(ExplorerCollectionTreeItem *const item, const EnsureIndexInfo &oldInfo, const EnsureIndexInfo &newInfo); void editIndexFromCollection(ExplorerCollectionTreeItem *const item,const std::string& oldIndexText,const std::string& newIndexText); + void retranslateUI(); public Q_SLOTS: void handle(MongoDatabaseCollectionListLoadedEvent *event); @@ -64,6 +67,12 @@ namespace Robomongo void addUserItem(MongoDatabase *database, const MongoUser &user); void addFunctionItem(MongoDatabase *database, const MongoFunction &function); + QAction *_openDbShellAction; + QAction *_dbStatsAction; + QAction *_dbDropAction; + QAction *_dbRepairAction; + QAction *_refreshDatabaseAction; + EventBus *_bus; ExplorerDatabaseCategoryTreeItem *_collectionFolderItem; ExplorerDatabaseCategoryTreeItem *_javascriptFolderItem; diff --git a/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.cpp b/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.cpp index 463c2c913..c5cbe6bf7 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.cpp +++ b/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.cpp @@ -21,19 +21,27 @@ namespace Robomongo _database(database) { - QAction *dropFunction = new QAction("Remove Function", this); - VERIFY(connect(dropFunction, SIGNAL(triggered()), SLOT(ui_dropFunction()))); + _dropFunctionAction = new QAction(this); + VERIFY(connect(_dropFunctionAction, SIGNAL(triggered()), SLOT(ui_dropFunction()))); - QAction *editFunction = new QAction("Edit Function", this); - VERIFY(connect(editFunction, SIGNAL(triggered()), SLOT(ui_editFunction()))); + _editFunctionAction = new QAction(this); + VERIFY(connect(_editFunctionAction, SIGNAL(triggered()), SLOT(ui_editFunction()))); - BaseClass::_contextMenu->addAction(editFunction); - BaseClass::_contextMenu->addAction(dropFunction); + BaseClass::_contextMenu->addAction(_editFunctionAction); + BaseClass::_contextMenu->addAction(_dropFunctionAction); setText(0, QtUtils::toQString(_function.name())); setIcon(0, GuiRegistry::instance().functionIcon()); setToolTip(0, buildToolTip(_function)); setExpanded(false); + + retranslateUI(); + } + + void ExplorerFunctionTreeItem::retranslateUI() + { + _dropFunctionAction->setText(tr("Remove Function")); + _editFunctionAction->setText(tr("Edit Function")); } QString ExplorerFunctionTreeItem::buildToolTip(const MongoFunction &function) @@ -48,7 +56,7 @@ namespace Robomongo FunctionTextEditor dlg(QtUtils::toQString(_database->server()->connectionRecord()->getFullAddress()), QtUtils::toQString(_database->name()), _function); - dlg.setWindowTitle("Edit Function"); + dlg.setWindowTitle(tr("Edit Function")); int result = dlg.exec(); if (result == QDialog::Accepted) { @@ -64,7 +72,7 @@ namespace Robomongo void ExplorerFunctionTreeItem::ui_dropFunction() { // Ask user - int answer = utils::questionDialog(treeWidget(),"Drop","Function",QtUtils::toQString(_function.name())); + int answer = utils::questionDialog(treeWidget(),tr("Drop"),tr("Function"),QtUtils::toQString(_function.name())); if (answer != QMessageBox::Yes) return; diff --git a/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.h b/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.h index bb5ee0865..c25792dbd 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerFunctionTreeItem.h @@ -15,6 +15,7 @@ namespace Robomongo ExplorerFunctionTreeItem(QTreeWidgetItem *parent,MongoDatabase *database, const MongoFunction &function); MongoFunction function() const { return _function; } MongoDatabase *database() const { return _database; } + void retranslateUI(); private Q_SLOTS: void ui_editFunction(); @@ -24,6 +25,9 @@ namespace Robomongo QString buildToolTip(const MongoFunction &function); MongoFunction _function; MongoDatabase *_database; + + QAction *_dropFunctionAction; + QAction *_editFunctionAction; }; } diff --git a/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.cpp b/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.cpp index 8d68c31fd..94d34b1e7 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.cpp +++ b/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.cpp @@ -30,42 +30,41 @@ namespace Robomongo _server(server), _bus(AppRegistry::instance().bus()) { - QAction *openShellAction = new QAction("Open Shell", this); - openShellAction->setIcon(GuiRegistry::instance().mongodbIcon()); - VERIFY(connect(openShellAction, SIGNAL(triggered()), SLOT(ui_openShell()))); + _openShellAction = new QAction(this); + _openShellAction->setIcon(GuiRegistry::instance().mongodbIcon()); + VERIFY(connect(_openShellAction, SIGNAL(triggered()), SLOT(ui_openShell()))); - QAction *refreshServer = new QAction("Refresh", this); - VERIFY(connect(refreshServer, SIGNAL(triggered()), SLOT(ui_refreshServer()))); + _refreshServerAction = new QAction(this); + VERIFY(connect(_refreshServerAction, SIGNAL(triggered()), SLOT(ui_refreshServer()))); - QAction *createDatabase = new QAction("Create Database", this); - VERIFY(connect(createDatabase, SIGNAL(triggered()), SLOT(ui_createDatabase()))); + _createDatabaseAction = new QAction(this); + VERIFY(connect(_createDatabaseAction, SIGNAL(triggered()), SLOT(ui_createDatabase()))); - QAction *serverStatus = new QAction("Server Status", this); - VERIFY(connect(serverStatus, SIGNAL(triggered()), SLOT(ui_serverStatus()))); + _serverStatusAction = new QAction(this); + VERIFY(connect(_serverStatusAction, SIGNAL(triggered()), SLOT(ui_serverStatus()))); - QAction *serverVersion = new QAction("MongoDB Version", this); - VERIFY(connect(serverVersion, SIGNAL(triggered()), SLOT(ui_serverVersion()))); + _serverVersionAction = new QAction(this); + VERIFY(connect(_serverVersionAction, SIGNAL(triggered()), SLOT(ui_serverVersion()))); - QAction *serverHostInfo = new QAction("Host Info", this); - VERIFY(connect(serverHostInfo, SIGNAL(triggered()), SLOT(ui_serverHostInfo()))); + _serverHostInfoAction = new QAction(this); + VERIFY(connect(_serverHostInfoAction, SIGNAL(triggered()), SLOT(ui_serverHostInfo()))); - QAction *showLog = new QAction("Show Log", this); - VERIFY(connect(showLog, SIGNAL(triggered()), SLOT(ui_showLog()))); + _showLogAction = new QAction(this); + VERIFY(connect(_showLogAction, SIGNAL(triggered()), SLOT(ui_showLog()))); - QAction *disconnectAction = new QAction("Disconnect", this); - disconnectAction->setIconText("Disconnect"); - VERIFY(connect(disconnectAction, SIGNAL(triggered()), SLOT(ui_disconnectServer()))); + _disconnectAction = new QAction(this); + VERIFY(connect(_disconnectAction, SIGNAL(triggered()), SLOT(ui_disconnectServer()))); - BaseClass::_contextMenu->addAction(openShellAction); - BaseClass::_contextMenu->addAction(refreshServer); + BaseClass::_contextMenu->addAction(_openShellAction); + BaseClass::_contextMenu->addAction(_refreshServerAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(createDatabase); - BaseClass::_contextMenu->addAction(serverStatus); - BaseClass::_contextMenu->addAction(serverHostInfo); - BaseClass::_contextMenu->addAction(serverVersion); + BaseClass::_contextMenu->addAction(_createDatabaseAction); + BaseClass::_contextMenu->addAction(_serverStatusAction); + BaseClass::_contextMenu->addAction(_serverHostInfoAction); + BaseClass::_contextMenu->addAction(_serverVersionAction); BaseClass::_contextMenu->addSeparator(); - BaseClass::_contextMenu->addAction(showLog); - BaseClass::_contextMenu->addAction(disconnectAction); + BaseClass::_contextMenu->addAction(_showLogAction); + BaseClass::_contextMenu->addAction(_disconnectAction); _bus->subscribe(this, DatabaseListLoadedEvent::Type, _server); _bus->subscribe(this, MongoServerLoadingDatabasesEvent::Type, _server); @@ -74,6 +73,8 @@ namespace Robomongo setIcon(0, GuiRegistry::instance().serverIcon()); setExpanded(true); setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); + + retranslateUI(); } void ExplorerServerTreeItem::expand() @@ -93,7 +94,7 @@ namespace Robomongo QIcon folderIcon = GuiRegistry::instance().folderIcon(); ExplorerTreeItem *systemFolder = new ExplorerTreeItem(this); systemFolder->setIcon(0, folderIcon); - systemFolder->setText(0, "System"); + systemFolder->setText(0, tr("System")); addChild(systemFolder); for (int i = 0; i < dbs.size(); i++) @@ -189,8 +190,8 @@ namespace Robomongo void ExplorerServerTreeItem::ui_createDatabase() { CreateDatabaseDialog dlg(QtUtils::toQString(_server->connectionRecord()->getFullAddress()), QString(), QString(), treeWidget()); - dlg.setOkButtonText("&Create"); - dlg.setInputLabelText("Database Name:"); + dlg.setOkButtonText(tr("&Create")); + dlg.setInputLabelText(tr("Database Name:")); int result = dlg.exec(); if (result == QDialog::Accepted) { _server->createDatabase(QtUtils::toStdStringSafe(dlg.databaseName())); @@ -199,4 +200,19 @@ namespace Robomongo expand(); } } + + void ExplorerServerTreeItem::retranslateUI() + { + _openShellAction->setText(tr("Open Shell")); + _refreshServerAction->setText(tr("Refresh")); + _createDatabaseAction->setText(tr("Create Database")); + _serverStatusAction->setText(tr("Server Status")); + _serverVersionAction->setText(tr("MongoDB Version")); + _serverHostInfoAction->setText(tr("Host Info")); + _showLogAction->setText(tr("Show Log")); + _disconnectAction->setText(tr("Disconnect")); + _disconnectAction->setIconText(tr("Disconnect")); + } + + } diff --git a/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.h b/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.h index bfe9af6d7..453b0cd1c 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerServerTreeItem.h @@ -24,6 +24,7 @@ namespace Robomongo ** Expand server tree item; */ void expand(); + void retranslateUI(); public Q_SLOTS: void databaseRefreshed(const QList &dbs); @@ -42,6 +43,15 @@ namespace Robomongo private: + QAction *_openShellAction; + QAction *_refreshServerAction; + QAction *_createDatabaseAction; + QAction *_serverStatusAction; + QAction *_serverVersionAction; + QAction *_serverHostInfoAction; + QAction *_showLogAction; + QAction *_disconnectAction; + /** * @brief Builds server * @param count: Number of databases. @@ -49,7 +59,7 @@ namespace Robomongo * If -1 - name will contain "..." at the end. */ QString buildServerName(int *count = NULL); - + MongoServer *const _server; EventBus *_bus; }; diff --git a/src/robomongo/gui/widgets/explorer/ExplorerTreeItem.h b/src/robomongo/gui/widgets/explorer/ExplorerTreeItem.h index b04229d84..3fcda222c 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerTreeItem.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerTreeItem.h @@ -17,6 +17,7 @@ namespace Robomongo virtual void showContextMenuAtPos(const QPoint &pos); using BaseClass::parent; virtual ~ExplorerTreeItem(); + virtual void retranslateUI(){}; protected: QMenu *const _contextMenu; diff --git a/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.cpp b/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.cpp index 847e9b940..0a5a7570c 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.cpp +++ b/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.cpp @@ -33,26 +33,34 @@ namespace Robomongo ExplorerUserTreeItem::ExplorerUserTreeItem(QTreeWidgetItem *parent,MongoDatabase *const database, const MongoUser &user) : BaseClass(parent),_user(user),_database(database) { - QAction *dropUser = new QAction("Drop User", this); - VERIFY(connect(dropUser, SIGNAL(triggered()), SLOT(ui_dropUser()))); + _dropUserAction = new QAction(this); + VERIFY(connect(_dropUserAction, SIGNAL(triggered()), SLOT(ui_dropUser()))); - QAction *editUser = new QAction("Edit User", this); - VERIFY(connect(editUser, SIGNAL(triggered()), SLOT(ui_editUser()))); + _editUserAction = new QAction(this); + VERIFY(connect(_editUserAction, SIGNAL(triggered()), SLOT(ui_editUser()))); - BaseClass::_contextMenu->addAction(editUser); - BaseClass::_contextMenu->addAction(dropUser); + BaseClass::_contextMenu->addAction(_editUserAction); + BaseClass::_contextMenu->addAction(_dropUserAction); setText(0, QtUtils::toQString(_user.name())); setIcon(0, GuiRegistry::instance().userIcon()); setExpanded(false); //setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator); setToolTip(0, QtUtils::toQString(buildToolTip(user))); + + retranslateUI(); + } + + void ExplorerUserTreeItem::retranslateUI() + { + _dropUserAction->setText(tr("Drop User")); + _editUserAction->setText(tr("Edit User")); } void ExplorerUserTreeItem::ui_dropUser() { // Ask user - int answer = utils::questionDialog(treeWidget(),"Drop","User",QtUtils::toQString(_user.name())); + int answer = utils::questionDialog(treeWidget(), tr("Drop"), tr("User"), QtUtils::toQString(_user.name())); if (answer == QMessageBox::Yes) { _database->dropUser(_user.id()); @@ -72,8 +80,8 @@ namespace Robomongo dlg = new CreateUserDialog(_database->server()->getDatabasesNames(), QtUtils::toQString(_database->server()->connectionRecord()->getFullAddress()), QtUtils::toQString(_database->name()), _user, treeWidget()); } - dlg->setWindowTitle("Edit User"); - dlg->setUserPasswordLabelText("New Password:"); + dlg->setWindowTitle(tr("Edit User")); + dlg->setUserPasswordLabelText(tr("New Password:")); int result = dlg->exec(); if (result == QDialog::Accepted) { diff --git a/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.h b/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.h index be48c5d46..77699a821 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerUserTreeItem.h @@ -13,7 +13,8 @@ namespace Robomongo public: typedef ExplorerTreeItem BaseClass; ExplorerUserTreeItem(QTreeWidgetItem *parent,MongoDatabase *const database, const MongoUser &user); - + void retranslateUI(); + private Q_SLOTS: void ui_dropUser(); void ui_editUser(); @@ -21,6 +22,9 @@ namespace Robomongo private: const MongoUser _user; MongoDatabase *_database; + + QAction *_dropUserAction; + QAction *_editUserAction; }; } diff --git a/src/robomongo/gui/widgets/explorer/ExplorerWidget.cpp b/src/robomongo/gui/widgets/explorer/ExplorerWidget.cpp index cf657cb9b..899f5c2b4 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerWidget.cpp +++ b/src/robomongo/gui/widgets/explorer/ExplorerWidget.cpp @@ -129,4 +129,33 @@ namespace Robomongo AppRegistry::instance().app()->openShell(collectionItem->collection()); } } + + void ExplorerWidget::retranslateUI() + { + QTreeWidgetItemIterator it(_treeWidget); + ExplorerTreeItem *item; + while (*it) { + item = dynamic_cast (*it); + if (item) { + item->retranslateUI(); + } + ++it; + } + } + + void ExplorerWidget::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + break; + } + } + BaseClass::changeEvent(event); + } } diff --git a/src/robomongo/gui/widgets/explorer/ExplorerWidget.h b/src/robomongo/gui/widgets/explorer/ExplorerWidget.h index 905cfdc43..863a38971 100644 --- a/src/robomongo/gui/widgets/explorer/ExplorerWidget.h +++ b/src/robomongo/gui/widgets/explorer/ExplorerWidget.h @@ -32,12 +32,15 @@ namespace Robomongo protected: virtual void keyPressEvent(QKeyEvent *event); + void changeEvent(QEvent*); private: int _progress; - void increaseProgress(); - void decreaseProgress(); QLabel *_progressLabel; QTreeWidget *_treeWidget; + + void increaseProgress(); + void decreaseProgress(); + void retranslateUI(); }; } diff --git a/src/robomongo/gui/widgets/workarea/BsonTreeModel.cpp b/src/robomongo/gui/widgets/workarea/BsonTreeModel.cpp index 3ddbbfb31..ffed977e8 100644 --- a/src/robomongo/gui/widgets/workarea/BsonTreeModel.cpp +++ b/src/robomongo/gui/widgets/workarea/BsonTreeModel.cpp @@ -24,13 +24,13 @@ namespace if (BsonUtils::isArray(element)) { int itemsCount = element.Array().size(); - childItemInner->setValue(QString("Array [%1]").arg(itemsCount)); + childItemInner->setValue(qApp->translate("parseDocument", "Array [%1]").arg(itemsCount)); //parseDocument(childItemInner,element.Obj()); } else if (BsonUtils::isDocument(element)) { int count = BsonUtils::elementsCount(element.Obj()); - childItemInner->setValue(QString("{ %1 fields }").arg(count)); - // parseDocument(childItemInner,element.Obj()); + childItemInner->setValue(qApp->translate("parseDocument", "{ %n fields }", "", count)); + // parseDocument(childItemInner,element.Obj()); } else { std::string result; @@ -64,10 +64,10 @@ namespace Robomongo idValue = idItem->value(); } - child->setKey(QString("(%1) %2").arg(i + 1).arg(idValue)); + child->setKey(tr("(%1) %2").arg(i + 1).arg(idValue)); int count = BsonUtils::elementsCount(doc->bsonObj()); - child->setValue(QString("{ %1 fields }").arg(count)); + child->setValue(tr("{ %n fields }", "", count)); child->setType(mongo::Object); _root->addChild(child); @@ -204,13 +204,13 @@ namespace Robomongo if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { if (section == BsonTreeItem::eKey) { - return "Key"; + return tr("Key"); } else if (section == BsonTreeItem::eValue) { - return "Value"; + return tr("Value"); } else { - return "Type"; + return tr("Type"); } } diff --git a/src/robomongo/gui/widgets/workarea/BsonTreeView.cpp b/src/robomongo/gui/widgets/workarea/BsonTreeView.cpp index 60e5fcc92..bb81dff7f 100644 --- a/src/robomongo/gui/widgets/workarea/BsonTreeView.cpp +++ b/src/robomongo/gui/widgets/workarea/BsonTreeView.cpp @@ -24,15 +24,37 @@ namespace Robomongo setContextMenuPolicy(Qt::CustomContextMenu); VERIFY(connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&)))); - _expandRecursive = new QAction("Expand Recursively", this); + _expandRecursive = new QAction(this); VERIFY(connect(_expandRecursive, SIGNAL(triggered()), SLOT(onExpandRecursive()))); setStyleSheet("QTreeView { border-left: 1px solid #c7c5c4; border-top: 1px solid #c7c5c4; }"); #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) header()->setSectionResizeMode(QHeaderView::Interactive); #endif + retranslateUI(); } + void BsonTreeView::retranslateUI() + { + _expandRecursive->setText(tr("Expand Recursively")); + } + + void BsonTreeView::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + break; + } + } + BaseClass::changeEvent(event); + } + void BsonTreeView::showContextMenu(const QPoint &point) { QPoint menuPoint = mapToGlobal(point); diff --git a/src/robomongo/gui/widgets/workarea/BsonTreeView.h b/src/robomongo/gui/widgets/workarea/BsonTreeView.h index b856adeb6..c015573e5 100644 --- a/src/robomongo/gui/widgets/workarea/BsonTreeView.h +++ b/src/robomongo/gui/widgets/workarea/BsonTreeView.h @@ -26,8 +26,11 @@ namespace Robomongo protected: virtual void resizeEvent(QResizeEvent *event); virtual void keyPressEvent(QKeyEvent *event); + void changeEvent(QEvent *event); private: + void retranslateUI(); + Notifier _notifier; QAction *_expandRecursive; }; diff --git a/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.cpp b/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.cpp index 3b776a2ea..fbba119cf 100644 --- a/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.cpp +++ b/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.cpp @@ -10,10 +10,6 @@ namespace Robomongo CollectionStatsTreeWidget::CollectionStatsTreeWidget(const std::vector &documents, QWidget *parent) : QTreeWidget(parent) { - QStringList colums; - colums << "Name" << "Count" << "Size" << "Storage" << "Index" << "Average Object" << "Padding"; - setHeaderLabels(colums); - setStyleSheet( "QTreeWidget { border-left: 1px solid #c7c5c4; border-top: 1px solid #c7c5c4; }" ); @@ -27,7 +23,32 @@ namespace Robomongo } addTopLevelItems(items); + + retranslateUI(); header()->resizeSections(QHeaderView::ResizeToContents); } + + void CollectionStatsTreeWidget::retranslateUI() + { + QStringList colums; + colums << tr("Name") << tr("Count") << tr("Size") << tr("Storage") << tr("Index") << tr("Average Object") << tr("Padding"); + setHeaderLabels(colums); + } + + void CollectionStatsTreeWidget::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + break; + } + } + BaseClass::changeEvent(event); + } } diff --git a/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.h b/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.h index d9306ac7d..44edc6946 100644 --- a/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.h +++ b/src/robomongo/gui/widgets/workarea/CollectionStatsTreeWidget.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "robomongo/core/Core.h" @@ -10,6 +11,13 @@ namespace Robomongo { Q_OBJECT public: + typedef QTreeWidget BaseClass; CollectionStatsTreeWidget(const std::vector &documents, QWidget *parent = NULL); + + protected: + void changeEvent(QEvent *event); + + private: + void retranslateUI(); }; } diff --git a/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.cpp b/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.cpp index debec213f..4b5841808 100644 --- a/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.cpp +++ b/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.cpp @@ -91,7 +91,7 @@ namespace Robomongo } } - _header->setTime(QString("%1 sec.").arg(secs)); + _header->setTime(tr("%1 sec.").arg(secs)); QVBoxLayout *layout = new QVBoxLayout(); layout->setContentsMargins(0, 0, 0, 0); @@ -110,6 +110,29 @@ namespace Robomongo refreshOutputItem(); } + + void OutputItemContentWidget::retranslateUI() + { + configureModel(); + markUninitialized(); + refreshOutputItem(); + } + + void OutputItemContentWidget::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + break; + } + } + BaseClass::changeEvent(event); + } void OutputItemContentWidget::paging_leftClicked(int skip, int limit) { @@ -215,7 +238,7 @@ namespace Robomongo } else { if (_documents.size() > 0) { - _textView->sciScintilla()->setText("Loading..."); + _textView->sciScintilla()->setText(tr("Loading...")); _thread = new JsonPrepareThread(_documents, AppRegistry::instance().settingsManager()->uuidEncoding(), AppRegistry::instance().settingsManager()->timeZone()); VERIFY(connect(_thread, SIGNAL(partReady(const QString&)), this, SLOT(jsonPartReady(const QString&)))); VERIFY(connect(_thread, SIGNAL(finished()), _thread, SLOT(deleteLater()))); diff --git a/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.h b/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.h index 60746cbf0..f1cda4ab5 100644 --- a/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.h +++ b/src/robomongo/gui/widgets/workarea/OutputItemContentWidget.h @@ -49,6 +49,9 @@ namespace Robomongo void showTable(); void showCustom(); + protected: + void changeEvent(QEvent *event); + private Q_SLOTS: void jsonPartReady(const QString &json); void refresh(int skip, int batchSize); @@ -57,6 +60,8 @@ namespace Robomongo private: void setup(double secs); + void retranslateUI(); + FindFrame *configureLogText(); BsonTreeModel *configureModel(); diff --git a/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.cpp b/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.cpp index 2fe4cee48..2ad63e237 100644 --- a/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.cpp +++ b/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.cpp @@ -36,7 +36,6 @@ namespace Robomongo // Maximaze button _maxButton = new QPushButton; _maxButton->setIcon(GuiRegistry::instance().maximizeIcon()); - _maxButton->setToolTip("Maximize or restore back this output result. You also can double-click on result's header."); _maxButton->setFixedSize(18, 18); _maxButton->setFlat(true); VERIFY(connect(_maxButton, SIGNAL(clicked()), this, SLOT(maximizePart()))); @@ -44,7 +43,6 @@ namespace Robomongo // Text mode button _textButton = new QPushButton(this); _textButton->setIcon(GuiRegistry::instance().textIcon()); - _textButton->setToolTip("View results in text mode"); _textButton->setFixedSize(24, 24); _textButton->setFlat(true); _textButton->setCheckable(true); @@ -53,7 +51,6 @@ namespace Robomongo _treeButton = new QPushButton(this); _treeButton->hide(); _treeButton->setIcon(GuiRegistry::instance().treeIcon()); - _treeButton->setToolTip("View results in tree mode"); _treeButton->setFixedSize(24, 24); _treeButton->setFlat(true); _treeButton->setCheckable(true); @@ -63,7 +60,6 @@ namespace Robomongo _tableButton = new QPushButton(this); _tableButton->hide(); _tableButton->setIcon(GuiRegistry::instance().tableIcon()); - _tableButton->setToolTip("View results in table mode"); _tableButton->setFixedSize(24, 24); _tableButton->setFlat(true); _tableButton->setCheckable(true); @@ -73,7 +69,6 @@ namespace Robomongo _customButton = new QPushButton(this); _customButton->hide(); _customButton->setIcon(GuiRegistry::instance().customIcon()); - _customButton->setToolTip("View results in custom UI"); _customButton->setFixedSize(24, 24); _customButton->setFlat(true); _customButton->setCheckable(true); @@ -125,6 +120,33 @@ namespace Robomongo layout->addWidget(createVerticalLine()); layout->addWidget(_maxButton, 0, Qt::AlignRight); setLayout(layout); + + retranslateUI(); + } + + void OutputItemHeaderWidget::retranslateUI() + { + _maxButton->setToolTip(tr("Maximize or restore back this output result. You also can double-click on result's header.")); + _textButton->setToolTip(tr("View results in text mode")); + _treeButton->setToolTip(tr("View results in tree mode")); + _tableButton->setToolTip(tr("View results in table mode")); + _customButton->setToolTip(tr("View results in custom UI")); + } + + void OutputItemHeaderWidget::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + break; + } + } + BaseClass::changeEvent(event); } void OutputItemHeaderWidget::mouseDoubleClickEvent(QMouseEvent *) diff --git a/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.h b/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.h index 5a74e738b..acd8b30ad 100644 --- a/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.h +++ b/src/robomongo/gui/widgets/workarea/OutputItemHeaderWidget.h @@ -19,6 +19,7 @@ namespace Robomongo Q_OBJECT public: + typedef QFrame BaseClass; OutputItemHeaderWidget(OutputItemContentWidget *output, QWidget *parent = 0); PagingWidget *paging() const { return _paging; } void showText(); @@ -28,6 +29,7 @@ namespace Robomongo protected: virtual void mouseDoubleClickEvent(QMouseEvent *); + void changeEvent(QEvent *event); Q_SIGNALS: void restoredSize(); @@ -39,6 +41,8 @@ namespace Robomongo void maximizePart(); private: + void retranslateUI(); + QPushButton *_textButton; QPushButton *_treeButton; QPushButton *_tableButton; diff --git a/src/robomongo/gui/widgets/workarea/PagingWidget.cpp b/src/robomongo/gui/widgets/workarea/PagingWidget.cpp index cbaf0550d..645594962 100644 --- a/src/robomongo/gui/widgets/workarea/PagingWidget.cpp +++ b/src/robomongo/gui/widgets/workarea/PagingWidget.cpp @@ -29,9 +29,8 @@ namespace Robomongo _skipEdit = new QLineEdit; _batchSizeEdit = new QLineEdit; _skipEdit->setAlignment(Qt::AlignHCenter); - _skipEdit->setToolTip("Skip"); + _batchSizeEdit->setAlignment(Qt::AlignHCenter); - _batchSizeEdit->setToolTip("Batch Size (number of documents shown at once)"); QFontMetrics metrics = _skipEdit->fontMetrics(); int width = metrics.boundingRect("000000").width(); @@ -61,6 +60,31 @@ namespace Robomongo layout->addSpacing(0); layout->addWidget(rightButton); setLayout(layout); + + retranslateUI(); + } + + void PagingWidget::retranslateUI() + { + _skipEdit->setToolTip(tr("Skip")); + _batchSizeEdit->setToolTip(tr("Batch Size (number of documents shown at once)")); + + } + + void PagingWidget::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + break; + } + } + BaseClass::changeEvent(event); } void PagingWidget::setSkip(int skip) diff --git a/src/robomongo/gui/widgets/workarea/PagingWidget.h b/src/robomongo/gui/widgets/workarea/PagingWidget.h index b59bc842e..a1c9a23d9 100644 --- a/src/robomongo/gui/widgets/workarea/PagingWidget.h +++ b/src/robomongo/gui/widgets/workarea/PagingWidget.h @@ -23,6 +23,9 @@ namespace Robomongo void rightClicked(int skip, int limit); void refreshed(int skip, int limit); + protected: + void changeEvent(QEvent *event); + private Q_SLOTS: void leftButton_clicked(); void rightButton_clicked(); @@ -31,5 +34,7 @@ namespace Robomongo private: QLineEdit *_skipEdit; QLineEdit *_batchSizeEdit; + + void retranslateUI(); }; } diff --git a/src/robomongo/gui/widgets/workarea/QueryWidget.cpp b/src/robomongo/gui/widgets/workarea/QueryWidget.cpp index 63dfa98d8..10db8f174 100644 --- a/src/robomongo/gui/widgets/workarea/QueryWidget.cpp +++ b/src/robomongo/gui/widgets/workarea/QueryWidget.cpp @@ -233,7 +233,7 @@ namespace Robomongo } if (tabTitle.isEmpty()&&shellQuery.isEmpty()) { - tabTitle = "New Shell"; + tabTitle = tr("New Shell"); } else { @@ -260,7 +260,7 @@ namespace Robomongo if (!empty) { bool isOutVisible = results.size() == 0 && !_scriptWidget->text().isEmpty(); if (isOutVisible) { - _outputLabel->setText(" Script executed successfully, but there are no results to show."); + _outputLabel->setText(tr(" Script executed successfully, but there are no results to show.")); } _outputLabel->setVisible(isOutVisible); } diff --git a/src/robomongo/gui/widgets/workarea/ScriptWidget.cpp b/src/robomongo/gui/widgets/workarea/ScriptWidget.cpp index 45d301584..17634ae6e 100644 --- a/src/robomongo/gui/widgets/workarea/ScriptWidget.cpp +++ b/src/robomongo/gui/widgets/workarea/ScriptWidget.cpp @@ -57,7 +57,7 @@ namespace Robomongo setStyleSheet("QFrame {background-color: rgb(255, 255, 255); border: 0px solid #c7c5c4; border-radius: 0px; margin: 0px; padding: 0px;}"); _queryText = new FindFrame(this); - _topStatusBar = new TopStatusBar(_shell->server()->connectionRecord()->getFullAddress(), "loading..."); + _topStatusBar = new TopStatusBar(_shell->server()->connectionRecord()->getFullAddress(), tr("loading...").toStdString()); QVBoxLayout *layout = new QVBoxLayout; layout->setSpacing(0); diff --git a/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.cpp b/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.cpp index 148a037dc..cc70626cf 100644 --- a/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.cpp +++ b/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.cpp @@ -20,16 +20,16 @@ namespace Robomongo _menu = new QMenu(this); - _newShellAction = new QAction("&New Shell", _menu); + _newShellAction = new QAction(_menu); _newShellAction->setShortcut(Qt::CTRL + Qt::Key_T); - _reloadShellAction = new QAction("&Reload", _menu); + _reloadShellAction = new QAction(_menu); _reloadShellAction->setShortcut(Qt::CTRL + Qt::Key_R); - _duplicateShellAction = new QAction("&Duplicate", _menu); - _pinShellAction = new QAction("&Pin Shell", _menu); - _closeShellAction = new QAction("&Close Shell", _menu); + _duplicateShellAction = new QAction(_menu); + _pinShellAction = new QAction(_menu); + _closeShellAction = new QAction(_menu); _closeShellAction->setShortcut(Qt::CTRL + Qt::Key_W); - _closeOtherShellsAction = new QAction("Close &Other Shells", _menu); - _closeShellsToTheRightAction = new QAction("Close Shells to the R&ight", _menu); + _closeOtherShellsAction = new QAction(_menu); + _closeShellsToTheRightAction = new QAction(_menu); _menu->addAction(_newShellAction); _menu->addSeparator(); @@ -39,7 +39,35 @@ namespace Robomongo _menu->addAction(_closeShellAction); _menu->addAction(_closeOtherShellsAction); _menu->addAction(_closeShellsToTheRightAction); - + + retranslateUI(); + } + + void WorkAreaTabBar::retranslateUI() + { + _newShellAction->setText(tr("&New Shell")); + _reloadShellAction->setText(tr("&Reload")); + _duplicateShellAction->setText(tr("&Duplicate")); + _pinShellAction->setText(tr("&Pin Shell")); + _closeShellAction->setText(tr("&Close Shell")); + _closeOtherShellsAction->setText(tr("Close &Other Shells")); + _closeShellsToTheRightAction->setText(tr("Close Shells to the R&ight")); + } + + void WorkAreaTabBar::changeEvent(QEvent* event) + { + if (0 != event) { + switch (event->type()) { + // this event is send if a translator is loaded + case QEvent::LanguageChange: + retranslateUI(); + break; + // this event is send, if the system, language changes + case QEvent::LocaleChange: + break; + } + } + BaseClass::changeEvent(event); } /** diff --git a/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.h b/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.h index b76f6059b..efcf8c7f7 100644 --- a/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.h +++ b/src/robomongo/gui/widgets/workarea/WorkAreaTabBar.h @@ -13,6 +13,7 @@ namespace Robomongo Q_OBJECT public: + typedef QTabBar BaseClass; /** * @brief Creates WorkAreaTabBar, without parent widget. We are * assuming, that tab bar will be installed to (and owned by) @@ -69,6 +70,8 @@ namespace Robomongo * open new shell. */ void mouseDoubleClickEvent(QMouseEvent *); + + void changeEvent(QEvent *event); private: /** @@ -90,6 +93,8 @@ namespace Robomongo */ void emitSignalForContextMenuAction(int tabIndex, QAction *action); + void retranslateUI(); + /** * @brief Builds stylesheet for this WorkAreaTabBar widget. */ diff --git a/src/robomongo/gui/widgets/workarea/WorkAreaTabWidget.cpp b/src/robomongo/gui/widgets/workarea/WorkAreaTabWidget.cpp index e3f4a2ae9..b7806d5d9 100644 --- a/src/robomongo/gui/widgets/workarea/WorkAreaTabWidget.cpp +++ b/src/robomongo/gui/widgets/workarea/WorkAreaTabWidget.cpp @@ -203,7 +203,7 @@ namespace Robomongo { const QString &title = event->shell->title(); - QString shellName = title.isEmpty() ? " Loading..." : title; + QString shellName = title.isEmpty() ? tr(" Loading...") : title; QueryWidget *queryWidget = new QueryWidget(event->shell,this); VERIFY(connect(queryWidget, SIGNAL(titleChanged(const QString &)), this, SLOT(tabTextChange(const QString &)))); diff --git a/src/robomongo/lang/CMakeLists.txt b/src/robomongo/lang/CMakeLists.txt new file mode 100644 index 000000000..84488bab1 --- /dev/null +++ b/src/robomongo/lang/CMakeLists.txt @@ -0,0 +1,21 @@ +SET(TRANSLATIONS + robomongo_de.ts + robomongo_en.ts + robomongo_pt.ts + robomongo_ru.ts +) + +SET(QM_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/qt_ru.qm +) + +FIND_PACKAGE(Qt5LinguistTools) +IF(UPDATE_TRANSLATIONS) + QT5_CREATE_TRANSLATION(QM_FILES ${CMAKE_SOURCE_DIR}/src/robomongo ${TRANSLATIONS} OPTIONS -no-obsolete -I ${CMAKE_SOURCE_DIR}/src) + MESSAGE("Updating *.ts files") +ELSE(UPDATE_TRANSLATIONS) + QT5_ADD_TRANSLATION(QM_FILES ${TRANSLATIONS}) + MESSAGE("Using existing *.ts files") +ENDIF(UPDATE_TRANSLATIONS) +SET(QM_FILES ${QM_FILES} PARENT_SCOPE) +ADD_CUSTOM_TARGET (translations ALL DEPENDS ${QM_FILES}) \ No newline at end of file diff --git a/src/robomongo/lang/qt_ru.qm b/src/robomongo/lang/qt_ru.qm new file mode 100644 index 000000000..63b7b8bf3 Binary files /dev/null and b/src/robomongo/lang/qt_ru.qm differ diff --git a/src/robomongo/lang/robomongo_de.ts b/src/robomongo/lang/robomongo_de.ts new file mode 100644 index 000000000..f7b2cf2b3 --- /dev/null +++ b/src/robomongo/lang/robomongo_de.ts @@ -0,0 +1,2002 @@ + + + + + QObject + + JavaScript (*.js);; All Files (*.*) + JavaScript (*.js);; Alle Dateien (*.*) + + + Error + Fehler + + + can't read from %1: +%2. + kann nicht von %1 lesen: +%2. + + + can't save to %1: +%2. + kann nicht zu %1 schreiben: +%2. + + + Save As + Speichern als + + + Array [%1] + Array [%1] + + + { %n fields } + + { %n Feld } + { %n Felder } + + + + Private key files (*.*) + Private-Key Dateien (*.*) + + + + Robomongo::AboutDialog + + + About + Über + + + + Shell-centric MongoDB management tool. + Shell-basierendes MongoDB Verwaltungswerkzeug. + + + + Visit %1 %2 + project title, 'website' word + Besuche %1 %2 + + + + website + Webseite + + + + Fork + Forke + + + + project or + Projekt oder + + + + submit + erstelle + + + + issues/proposals on GitHub. + Issues auf GitHub. + + + + All rights reserved + Alle Rechte vorbehalten + + + + The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + Das Programm wird geliefert WIE ES IST ohne GARANTIE IRGENDEINER ART, EINSCHLIESSLICH DER GARANTIE FÜR DESIGN, EIGNUNG FÜR EINEN BESTIMMTEN ZWECK. + + + + Robomongo::BsonTreeModel + + + (%1) %2 + (%1) %2 + + + + { %n fields } + + { %n Feld } + { %n Felder } + + + + + Key + Schlüssel + + + + Value + Wert + + + + Type + Typ + + + + Robomongo::BsonTreeView + + + Expand Recursively + Erweitere rekursiv + + + + Robomongo::CollectionStatsTreeWidget + + + Name + Name + + + + Count + Anzahl + + + + Size + Größe + + + + Storage + Speicherung + + + + Index + Index + + + + Average Object + Durchschnittsobjekt + + + + Padding + Zwischenraum + + + + Robomongo::ConnectionAdvancedTab + + + Database, that will be default (<code>db</code> shell variable will point to this database). By default, default database will be the one you authenticate on, or <code>test</code> otherwise. Leave this field empty, if you want default behaviour. + Standard Datenbank (<code>db</code> Shellvariable wird darauf zeigen). Normalerweise ist dies die Datenbank, mit der Sie sich authentifizieren. Lassen Sie das Feld leer, wenn Sie Standardverhalten wünschen. + + + + Default Database: + Standard Datenbank: + + + + Robomongo::ConnectionAuthTab + + + <nobr>The <code>admin</code> database is unique in MongoDB.</nobr> Users with normal access to the <code>admin</code> database have read and write access to <b>all databases</b>. + <nobr>Die <code>Admin</code> Datenbank ist eindeutig in MongoDB.</nobr> Benutzer mit normalem Zugang zu der <code>Admin</code> Datenbank haben Lese- und Schreibberechtigung zu <b>allen Datenbanken</b>. + + + + User Name + Benutzername + + + + Password + Passwort + + + + Database + Datenbank + + + + Perform authentication + Authentifizieren + + + + + Show + Zeigen + + + + Hide + Verstecken + + + + Robomongo::ConnectionBasicTab + + + Choose any connection name that will help you to identify this connection. + Wählen Sie einen Verbindungsname, der Ihnen helfen wird diese Verbindung zu indentifizieren. + + + + Specify host and port of MongoDB server. Host can be either IP or domain name. + Geben Sie Host und Port von dem MongoDB Server an. Der Host kann eine IP-Adresse oder ein Domainname sein. + + + + Name: + Name: + + + + Address: + Adresse: + + + + Robomongo::ConnectionDiagnosticDialog + + + Diagnostic + Diagnose + + + + &Close + &Schließen + + + + Connecting to <b>%1</b>... + Verbindet zu <b>%1</b>... + + + + Authorizing on <b>%1</b> database as <b>%2</b>... + Autorisiere zu Datenbank <b>%1</b> als <b>%2</b>... + + + + + Authorization skipped by you + Autorisation übersprungen + + + + Connected to <b>%1</b> + Verbunden zu <b>%1</b> + + + + Unable to connect to <b>%1</b> + Fehler beim Verbinden zu <b>%1</b> + + + + Authorized as <b>%1</b> + Autorisiert als <b>%1</b> + + + + Authorization failed + Autorisation fehlgeschlagen + + + + Robomongo::ConnectionDialog + + + Connection Settings + Verbindungseinstellungen + + + + Connection + Verbindung + + + + Authentication + Authentifikation + + + + Advanced + Erweitert + + + + Invalid Transport + Ungültiger Transport + + + + SSH and SSL cannot be enabled simultaneously. Please uncheck one of them. + SHH und SSL können nicht beide gleichzeitig aktiv sein. Bitte deaktivieren sie eins von beiden. + + + + Robomongo::ConnectionSslTab + + + Use SSL protocol + Benutze SSL Protokol + + + + SSL Certificate: + SSL Zertifikat: + + + + <nobr>SSL Certificate and SSL Private Key combined into one file (*.pem) + <nobr>SSL Zeritfikat und SSL Private-Key in einer Datei (*.pem) + + + + <b>Note:</b> Support for Certificate Authority (CA) file and encrypted SSL Private Keys are planned for future releases. + <b>Hinweis:</b>Unterstützung für Certificate Authority (CA) Datei und verschlüsselte SSL Private-Keys sind geplant für spätere Releases. + + + + Select SSL Key File (PEM) + Wählen Sie SSL Key Datei (PEM) + + + + PEM files (*.pem) + PEM Dateien (*.pem) + + + + Robomongo::ConnectionsDialog + + + MongoDB Connections + MongoDB Verbindungen + + + + &Add... + &Hinzufügen... + + + + &Edit... + &Bearbeiten... + + + + &Clone... + &Klonen... + + + + &Remove... + &Entfernen... + + + + Name + Name + + + + Address + Adresse + + + + Auth. Database / User + Auth. Datenbank / Benutzer + + + + C&onnect + &Verbinden + + + + Create + Erstellen + + + + edit + bearbeiten + + + + remove + entfernen + + + + clone + klonen + + + + or reorder connections via drag'n'drop. + oder ordnen Sie die Verbindungen via Drag'n'Drop. + + + + Connections + Verbindungen + + + + Really delete "%1" connection? + "%1" wirklich entfernen? + + + + Copy of %1 + Kopie von %1 + + + + Robomongo::CopyCollection + + + Copy Collection + Kollektion kopieren + + + + Copy + Kopieren + + + + Select server: + Server: + + + + Copy <b>%1</b> collection to database on this or another server. You need to be already connected to destination server, in order to see this server in the list below. This operation will <i>not</i> overwrite existing documents with the same _id. + Kopiere Kollektion <b>%1</b> zur Datenbank auf diesem oder einem anderem Server. Eine Verbindung zum Zielserver muss bereits vorhanden sein, um diesen Server in der Liste unterhalb zu sehen. Dieser Vorgand wird <i>keine</i> vorhandenen Dokumente mit der selben _id überschreiben. + + + + Select database: + Datenbank: + + + + Robomongo::CreateDatabaseDialog + + + Create Database + Datenbank erstellen + + + + Database Name: + Datenbankname: + + + + C&reate + &Erstellen + + + + Robomongo::CreateUserDialog + + + + Add User + Benutzer hinzufügen + + + + + Name: + Name: + + + + + Password: + Passwort: + + + + UserSource: + Benutzerkontext: + + + + Read Only + Nur Lesen + + + + Invalid input + Ungültige Eingabe + + + + The UserSourse field and the Password field are mutually exclusive. The document cannot contain both. + + Die Benutzerkontext- und Passwortfelder sind gegenseitig alleinig. Das Dokument kann nicht beide beinhalten. + + + + + Robomongo::DialogUtils + + + %1 %2 + Title for dialogs + + + + + %1 <b>%3</b> %2? + Text for dialogs + + + + + Robomongo::DocumentTextEditor + + + Validate + Validieren + + + + Unable to parse JSON:<br /> <b>%1</b>, at (%2, %3). + Konnte JSON nicht parsen:<br /> <b>%1</b>, bei (%2, %3). + + + + Parsing error + Fehler beim Parsen + + + + Validation + Überprüfung + + + + JSON is valid! + JSON ist gültig! + + + + Robomongo::EditIndexDialog + + + Index Properties + Index Eigenschaften + + + + Basic + Einfach + + + + Advanced + Erweitert + + + + Text Search + Textsuche + + + + Unique + Eindeutig + + + + Drop duplicates + Duplikate entfernen + + + + Choose any name that will help you to identify this index. + Wählen Sie einen Namen, der Ihnen helfen wird diesen Index zu indentifizieren. + + + + Document that contains pairs with the name of the field or fields to index and order of the index. A 1 specifies ascending and a -1 specifies descending. + Dokument, das Paare mit dem Name des Feldes/der Felder und der Reihenfolge des Index enthält. 1 gilt für aufsteigend, -1 für absteigend. + + + + If set, creates a unique index so that the collection will not accept insertion of documents where the index key or keys match an existing value in the index. + Erstellt einen eindeutigen Index, sodass die Kollektion keine Einführung von Dokumenten annimmt, dessen Index gleich einem vorhandenem Index ist. + + + + MongoDB cannot create a unique index on a field that has duplicate values. To force the creation of a unique index, you can specify the dropDups option, which will only index the first occurrence of a value for the key, and delete all subsequent values. + MongoDB kann keinen eindeutigen Index auf einem Feld erstellen, für das Duplikate existieren. Um die Erstellen eines eindeutigen Index zu erzwingen, wählen Sie diese Option. Dann wird nur das erste Vorkommen von einem Wert für den Schlüssel indiziert, alle nachfolgenden Werte werden gelöscht. + + + + Name: + Name: + + + + Keys: + Schlüssel: + + + + Sparse + Spärlich + + + + Create index in background + Im Hintergrund erstellen + + + + seconds + Sekunden + + + + Expire after + Läuft ab nach + + + + If set, the index only references documents with the specified field. These indexes use less space but behave differently in some situations (particularly sorts). + Der Index referenziert dann nur Dokumente mit dem angegebenem Feld. Diese Indizes verbrauchen weniger Platz, verhalten sich aber anders in einigen Situationen (insbesondere beim Sortieren). + + + + Builds the index in the background so that building an index does not block other database activities. + Erstellt den Index im Hintergrund, sodass andere Aktivitäten nicht geblockt werden. + + + + Specifies a <i>time to live</i>, in seconds, to control how long MongoDB retains documents in this collection + Gibt eine <i>Lebenszeit</i> in Sekunden an, um zu kontrollieren wie lange MongoDB Dokumente in dieser Kollektion behält + + + + For a <i>text</i> index, the language that determines the list of stop words and the rules for the stemmer and tokenizer. The default value is <b>english</b> + Für einen <i>Text<i> Index entscheidet die Sprache, wo Wörter aufhören und Stammformen liegen. Die Standardsprache ist <b>Englisch</b> + + + + For a <i>text</i> index, specify the name of the field in the document that contains, for that document, the language to override the default language. The default value is <b>language</b> + Setzen Sie den Namen des Feldes für den <i>Text</i> Index, welches die Sprache für das Dokument enthält. Diese überschreibt dann die Standardsprache. Der Standardwert ist <b>language</b> + + + + Document that contains field and weight pairs. The weight is a number ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields. + Dokument, das ein Feld-Gewichtung-Paar enthält. Die Gewichtung ist eine Zahl von 1 to 99.999 and gibt die Wichtigkeit des Feldes relativ zu anderen Feldern an. + + + + Default language: + Standardsprache: + + + + Language override: + Überschreibende Sprache: + + + + Text weights + Textgewichtung + + + + + Invalid json + Ungültiges JSON + + + + + Please check json text. + + Bitte überprüfen Sie den JSON Text. + + + + Robomongo::ExplorerCollectionDirIndexesTreeItem + + + + Add Index... + Index hinzufügen... + + + + Drop Index... + Index entfernen... + + + + Rebuild Indexes... + Indizes neuerstellen... + + + + View Indexes + Indizes anzeigen + + + + Refresh + Neuladen + + + + Indexes + Indizes + + + + A unique index causes MongoDB to reject all documents that contain a duplicate value for the indexed field. + Ein eindeutiger Index veranlässt MongoDB alle Dokumente, welche den selben Wert für dieses Feld besitzen,zu entfernen. + + + + Sparse indexes only contain entries for documents that have the indexed field. + Spärliche Indizes besitzen nur Einträge für Dokumente, die das indizierte Feld beinhalten. + + + + Robomongo::ExplorerCollectionIndexesTreeItem + + + Drop Index... + Index entfernen... + + + + Edit Index... + Index bearbeiten... + + + + Drop + Entfernen + + + + Index + Index + + + + Robomongo::ExplorerCollectionTreeItem + + + Insert Document... + Dokument einsetzen... + + + + Update Documents... + Dokumente bearbeiten... + + + + Remove Documents... + Dokumente entfernen... + + + + Remove All Documents... + Alle Dokumente entfernen... + + + + Statistics + Statistiken + + + + Storage Size + Speicherungsgröße + + + + Total Index Size + Totale Indexgröße + + + + Total Size + Totale Größe + + + + Shard Version + Splitterversion + + + + Shard Distribution + Splitterverteilung + + + + Drop Collection... + Kollektion entfernen... + + + + Rename Collection... + Kollektion umbenennen... + + + + Duplicate Collection... + Kollektion duplizieren... + + + + Copy Collection to Database... + Kollektion zu Datenbank kopieren... + + + + View Documents + Dokumente anzeigen + + + + Insert Document + Dokumente einfügen + + + + Remove All Documents + Alle Dokumente entfernen + + + + Remove all documents from <b>%1</b> collection? + Entferne alle Dokumente von Kollektion <b>%1</b>? + + + + update only one document + Nur ein Dokument bearbeiten + + + + insert a new document, if no existing document match the query + Neues Dokument einfügen, falls kein vorhandenes Dokument die Suchanfrage erfüllt + + + + Drop + Entfernen + + + + collection + Kollektion + + + + Duplicate Collection + Kollektion duplizieren + + + + &Duplicate + &Duplizieren + + + + + New Collection Name: + Neuer Kollektionsname: + + + + Rename Collection + Kollektion umbenennen + + + + &Rename + &Umbenennen + + + + Robomongo::ExplorerDatabaseCategoryTreeItem + + + Create Collection... + Kollektion erstellen... + + + + Collections Statistics + Kollektionsstatistiken + + + + + + Refresh + Neuladen + + + + View Users + Benutzer anzeigen + + + + Add User... + Benutzer hinzufügen... + + + + View Functions + Funktionen anzeigen + + + + Add Function... + Funktion hinzufügen... + + + + Create Collection + Kollektion erstellen + + + + &Create + &Erstellen + + + + Collection Name: + Kollektionsname: + + + + Create Function + Funktion erstellen + + + + write your code here + Schreiben Sie den Code hier + + + + Robomongo::ExplorerDatabaseTreeItem + + + Open Shell + Shell öffnen + + + + Database Statistics + Datenbankstatistiken + + + Drop Database.. + Datenbank entfernen... + + + + Drop Database... + Datenbank entfernen... + + + + Repair Database... + Datenbank reparieren... + + + + Refresh + Neuladen + + + + + + Collections + Kollektionen + + + + + + Functions + Funktionen + + + + + + Users + Benutzer + + + + System + System + + + + Drop <b>%1</b> database? + Entferne Datenbank <b>%1</b>? + + + + Drop Database + Datenbank entfernen + + + + Robomongo::ExplorerFunctionTreeItem + + + Remove Function + Funktion entfernen + + + + + Edit Function + Funktion bearbeiten + + + + Drop + Entfernen + + + + Function + Funktion + + + + Robomongo::ExplorerServerTreeItem + + + Open Shell + Shell öffnen + + + + Refresh + Neuladen + + + + Create Database + Datenbank erstellen + + + + Server Status + Serverstatus + + + + MongoDB Version + MongoDB Version + + + + Host Info + Hostinformationen + + + + Show Log + Log anzeigen + + + + + Disconnect + Verbindung trennen + + + + System + System + + + + &Create + &Erstellen + + + + Database Name: + Datenbankname: + + + + Robomongo::ExplorerUserTreeItem + + + Drop User + Benutzer entfernen + + + + + Edit User + Benutzer bearbeiten + + + + Drop + Entfernen + + + + User + Benutzer + + + + New Password: + Neues Passwort: + + + + Robomongo::FindFrame + + + Next + Weiter + + + + Previous + Zurück + + + + Match case + Groß-/Kleinschreibung + + + + Search + Suchen + + + + The specified text was not found. + Der angegebene Text wurde nicht gefunden. + + + + Robomongo::FunctionTextEditor + + + Name: + Name: + + + + Code: + Code: + + + + Robomongo::LogWidget + + + Clear All + Alle löschen + + + + Robomongo::MainWindow + + + &Open... + &Öffnen... + + + + Load script from the file to the currently opened shell + Öffne Script aus Datei in aktuell geöffnete Shell + + + + &Save + &Speichern + + + + Save &As... + Speichern &als... + + + + &Exit + &Schließen + + + + + &Connect... + &Verbinden... + + + + Connect + Verbinden + + + + &Rotate + &Drehen + + + + Toggle orientation of results view <b>(F10)</b> + Ausrichtung von Ergebnissen umschalten <b>(F10)</b> + + + + &Text Mode + &Textmodus + + + + Show current tab in text mode, and make this mode default for all subsequent queries <b>(F4)</b> + Zeige aktuellen Tab im Textmodus und stelle den Standard darauf ein <b>(F4)</b> + + + + &Tree Mode + &Verzeichnissbaummodus + + + + Show current tab in tree mode, and make this mode default for all subsequent queries <b>(F3)</b> + Zeige aktuellen Tab im Verzeichnissbaummodus und stelle den Standard darauf ein <b>(F3)</b> + + + + T&able Mode + T&abellenmodus + + + + Show current tab in table mode, and make this mode default for all subsequent queries <b>(F3)</b> + Zeige aktuellen Tab im Tabellenmodus und stelle den Standard darauf ein <b>(F3)</b> + + + + &Custom Mode + &Benutzerdefinierter Modus + + + + Show current tab in custom mode if possible, and make this mode default for all subsequent queries <b>(F2)</b> + Zeige aktuellen Tab im benutzerdefinierten Modus und stelle den Standard darauf ein <b>(F2)</b> + + + + Stop execution of currently running script. <b>(F6)</b> + Ausführung aktuell laufenden Scriptes anhalten. <b>(F6)</b> + + + + Show Line Numbers By Default + + + + + Window + + + + + &Full Screen + &Vollbildmodus + + + + Refresh + Neuladen + + + + File + Datei + + + + View + Ansicht + + + + Options + Optionen + + + + Default View Mode + Standard Ansichtsmodus + + + + Display Dates In... + Zeige Daten in... + + + + Auto Expand First Document + Erstes Dokument automatisch erweitern + + + + Do not decode (show as is) + Nicht dekodieren + + + + Use Java Encoding + Benutze Java Verschlüsselung + + + + Use .NET Encoding + Benutze .NET Verschlüsselung + + + + Use Python Encoding + Benutze Python Verschlüsselung + + + + Legacy UUID Encoding + Legacy UUID Verschlüsselung + + + + Load .mongorc.js + Lade .mongorc.js + + + + Ctrl + Strg + + + + Save script of the currently opened shell to the file <b>(%1 + S)</b> + Skript aus aktuell geöffneter Shell in Datei speichern <b>(%1 + S)</b> + + + + + Connect to local or remote MongoDB instance <b>(%1 + O)</b> + Verbindung zu einer lokalen oder entfernten MongoDB Instanz <b>(%1 + O)</b> + + + + Execute query for current tab. If you have some selection in query text - only selection will be executed <b>(F5 </b> or <b>%1 + Enter)</b> + Abfrage für aktuellen Tab ausführen. Falls Text in der Abfrage makiert ist, wird nur dieser ausgeführt <b>(F5 </b> oder <b>%1 + Enter)</b> + + + + Disable Connection Shortcuts + Deaktiviere Verbindungstastenkürzel + + + + Preferences + Einstellungen + + + + &About Robomongo... + &Über Robomongo... + + + + &Minimize + + + + + Select Next Tab + + + + + Select Previous Tab + + + + + Help + Hilfe + + + + Toolbar + Symbolleiste + + + + Open/Save ToolBar + Symbolleiste öffnen/speichern + + + + Exec Toolbar + Symbolleiste ausführen + + + + Theme + Thema + + + + Language + Sprache + + + + System locale (if available) + Language based on system locale + Systemsprache + + + + + Logs + Logs + + + + &Manage Connections... + &Verwalte Verbindungen... + + + + Connect to MongoDB + Verbinde zu MongoDB + + + + + Cannot connect to MongoDB (%1) + Konnte nicht zu MongoDB verbinden (%1) + + + + + + Error + Fehler + + + + Refresh not working yet... : <br/> <b>Ctrl+D</b> : push Button + Neuladen funktionier noch nicht... : <br/> <b>Strg+D</b> : push-Button + + + + Cannot connect to MongoDB (%1), +error: %2 + Konnte nicht zu MongoDb verbinden (%1), +Fehler: %2 + + + + Database Explorer + Datenbankexplorer + + + + &Explorer + &Explorer + + + + Press to show/hide Database Explorer panel. + Drücken Sie um das Datenbankexplorerfenster anzuzeigen/zu verstecken. + + + + &Logs + &Logs + + + + Robomongo::MongoWorker + + + Unable to authorize + Nicht möglich zu autorisieren + + + + Unable to connect to MongoDB + Nicht möglich zu MongoDB zu verbinden + + + + Unable to load database names. + Nicht möglich Datenbanknamen zu laden. + + + + Unable to load list of collections. + Nicht möglich Kollektionsliste zu laden. + + + + Unable to load list of users. + Nicht möglich Benutzerliste zu laden. + + + + Unable to load list of functions. + Nicht möglich Funktionsliste zu laden. + + + + Unable to insert document. + Nicht möglich Dokument einzufügen. + + + + Unable to remove documents. + Nicht möglich Dokument zu entfernen. + + + + + Unable to complete query. + Nicht möglich Abfrage zu vervollständigen. + + + + Unable to autocomplete query. + Nicht möglich Abfrage zu autovervollständigen. + + + + Unable to create database. + Nicht möglich Datenbank zu erstellen. + + + + Unable to drop database. + Nicht möglich Datenbank zu entfernen. + + + + Unable to create collection. + Nicht möglich Kolletion zu erstellen. + + + + Unable to drop collection. + Nicht möglich Kollektion zu löschen. + + + + Unable to rename collection. + Nicht möglich Kollektion umzubenennen. + + + + Unable to duplicate collection. + Nicht möglich Kollektion zu duplizieren. + + + + Unable to copy collection. + Nicht möglich Kollektion zu kopieren. + + + + Unable to create/ovewrite user. + Nicht möglich Benutzer zu erstellen/überschreiben. + + + + Unable to drop user. + Nicht möglich Benutzer zu löschen. + + + + Unable to create/ovewrite function. + Nicht möglich Funktion zu erstellen/überschreiben. + + + + Unable to drop function. + Nicht möglich Funktion zu entfernen. + + + + Robomongo::Notifier + + + Delete Document... + Dokument entfernen... + + + + Delete Documents... + Dokumente entfernen... + + + + Edit Document... + Dokument bearbeiten... + + + + View Document... + Dokument anzeigen... + + + + Insert Document... + Dokument einsetzen... + + + + Copy Value + Wert kopieren + + + + Copy JSON + JSON kopieren + + + + Cannot delete + Konnte nicht entfernen + + + + Selected document doesn't have _id field. +Maybe this is a system document that should be managed in a special way? + Ausgewähltes Dokument hat kein _id Feld. +Vielleicht ist dies ein Systemdokument das auf spezielle Weise verwaltet werden sollte? + + + + + Delete + Entfernen + + + + Document + Dokument + + + + %1 %2 with id:<br><b>%3</b>? + %1 %2 mit id:<br><b>%3</b>? + + + + Do you want to delete %n selected documents? + + %n ausgewählte Dokumente entfernen? + %n ausgewählte Dokumente entfernen? + + + + + Edit Document + Dokument bearbeiten + + + + View Document + Dokument anzeigen + + + + Insert Document + Dokument einsetzen + + + + Robomongo::OutputItemContentWidget + + + %1 sec. + %1 sek. + + + + Loading... + Lädt... + + + + Robomongo::OutputItemHeaderWidget + + + Maximize or restore back this output result. You also can double-click on result's header. + Ausgabefenster maximieren oder wiederherstellen. + + + + View results in text mode + Ergebnisse in Textmodus anzeigen + + + + View results in tree mode + Ergebnisse in Verzeichnisbaummodus anzeigen + + + + View results in table mode + Ergebnisse in Tabellenmodus anzeigen + + + + View results in custom UI + Ergebnisse im benutzerdefiniertem Modus anzeigen + + + + Robomongo::PagingWidget + + + Skip + Überspringen + + + + Batch Size (number of documents shown at once) + Batchgröße (Anzahl gezeigter Dokumente) + + + + Robomongo::QueryWidget + + + New Shell + Neue Shell + + + + Script executed successfully, but there are no results to show. + Script erfolgreich ausgeführt, es gibt allerdings keine Ergebnisse. + + + Script executed successfully, but there is no results to show. + Script erfolgreich ausgeführt, es gibt allerdings keine Ergebnisse. + + + + Robomongo::ScriptInfo + + + JavaScript (*.js);; All Files (*.*) + JavaScript (*.js);; Alle Dateien (*.*) + + + + Save As + Speichern als + + + + Robomongo::ScriptWidget + + + loading... + lädt... + + + + Robomongo::SettingsManager + + + + __LANGUAGE_NAME__ + Native language name: "English" for English, "Русский" for Russian etc. + Deutsch + + + + Robomongo::SshTunelTab + + + Use SSH tunnel + Benutze SSH Tunnel + + + + + Password + Passwort + + + + + Private Key + Private Key + + + + User Password: + + + + + Private key: + + + + + Passphrase: + + + + + SSH Address: + + + + + SSH User Name: + + + + + SSH Auth Method: + + + + + Select private key file + Wähle Private Key Datei + + + + Private key files (*.*) + Private-Key Dateien (*.*) + + + + Robomongo::WorkAreaTabBar + + + &New Shell + &Neue Shell + + + + &Reload + N&euladen + + + + &Duplicate + &Duplizieren + + + + &Pin Shell + Shell &anheften + + + + &Close Shell + Shell &schließen + + + + Close &Other Shells + S&chließe andere Shells + + + + Close Shells to the R&ight + Shells nach &rechts schließen + + + + Robomongo::WorkAreaTabWidget + + + Loading... + lädt... + + + + loadFromFileText + + + Error + Fehler + + + + can't read from %1: +%2. + kann nicht von %1 lesen: +%2. + + + + parseDocument + + + Array [%1] + Array [%1] + + + + { %n fields } + + { %n Feld } + { %n Felder } + + + + + saveToFileText + + + Error + Fehler + + + + can't save to %1: +%2. + kann nicht zu %1 schreiben: +%2. + + + diff --git a/src/robomongo/lang/robomongo_en.ts b/src/robomongo/lang/robomongo_en.ts new file mode 100644 index 000000000..d74d0792b --- /dev/null +++ b/src/robomongo/lang/robomongo_en.ts @@ -0,0 +1,1957 @@ + + + + + QObject + + { %n fields } + + { %n field } + { %n fields } + + + + + Robomongo::AboutDialog + + + About + + + + + Shell-centric MongoDB management tool. + + + + + Visit %1 %2 + project title, 'website' word + + + + + website + + + + + Fork + + + + + project or + + + + + submit + + + + + issues/proposals on GitHub. + + + + + All rights reserved + + + + + The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + + + + Robomongo::BsonTreeModel + + + (%1) %2 + + + + + { %n fields } + + { %n field } + { %n fields } + + + + + Key + + + + + Value + + + + + Type + + + + + Robomongo::BsonTreeView + + + Expand Recursively + + + + + Robomongo::CollectionStatsTreeWidget + + + Name + + + + + Count + + + + + Size + + + + + Storage + + + + + Index + + + + + Average Object + + + + + Padding + + + + + Robomongo::ConnectionAdvancedTab + + + Database, that will be default (<code>db</code> shell variable will point to this database). By default, default database will be the one you authenticate on, or <code>test</code> otherwise. Leave this field empty, if you want default behaviour. + + + + + Default Database: + + + + + Robomongo::ConnectionAuthTab + + + <nobr>The <code>admin</code> database is unique in MongoDB.</nobr> Users with normal access to the <code>admin</code> database have read and write access to <b>all databases</b>. + + + + + User Name + + + + + Password + + + + + Database + + + + + Perform authentication + + + + + + Show + + + + + Hide + + + + + Robomongo::ConnectionBasicTab + + + Choose any connection name that will help you to identify this connection. + + + + + Specify host and port of MongoDB server. Host can be either IP or domain name. + + + + + Name: + + + + + Address: + + + + + Robomongo::ConnectionDiagnosticDialog + + + Diagnostic + + + + + &Close + + + + + Connecting to <b>%1</b>... + + + + + Authorizing on <b>%1</b> database as <b>%2</b>... + + + + + + Authorization skipped by you + + + + + Connected to <b>%1</b> + + + + + Unable to connect to <b>%1</b> + + + + + Authorized as <b>%1</b> + + + + + Authorization failed + + + + + Robomongo::ConnectionDialog + + + Connection Settings + + + + + Connection + + + + + Authentication + + + + + Advanced + + + + + Invalid Transport + + + + + SSH and SSL cannot be enabled simultaneously. Please uncheck one of them. + + + + + Robomongo::ConnectionSslTab + + + Use SSL protocol + + + + + SSL Certificate: + + + + + <nobr>SSL Certificate and SSL Private Key combined into one file (*.pem) + + + + + <b>Note:</b> Support for Certificate Authority (CA) file and encrypted SSL Private Keys are planned for future releases. + + + + + Select SSL Key File (PEM) + + + + + PEM files (*.pem) + + + + + Robomongo::ConnectionsDialog + + + MongoDB Connections + + + + + &Add... + + + + + &Edit... + + + + + &Clone... + + + + + &Remove... + + + + + Name + + + + + Address + + + + + Auth. Database / User + + + + + C&onnect + + + + + Create + + + + + edit + + + + + remove + + + + + clone + + + + + or reorder connections via drag'n'drop. + + + + + Connections + + + + + Really delete "%1" connection? + + + + + Copy of %1 + + + + + Robomongo::CopyCollection + + + Copy Collection + + + + + Copy + + + + + Select server: + + + + + Copy <b>%1</b> collection to database on this or another server. You need to be already connected to destination server, in order to see this server in the list below. This operation will <i>not</i> overwrite existing documents with the same _id. + + + + + Select database: + + + + + Robomongo::CreateDatabaseDialog + + + Create Database + + + + + Database Name: + + + + + C&reate + + + + + Robomongo::CreateUserDialog + + + + Add User + + + + + + Name: + + + + + + Password: + + + + + UserSource: + + + + + Read Only + + + + + Invalid input + + + + + The UserSourse field and the Password field are mutually exclusive. The document cannot contain both. + + + + + + Robomongo::DialogUtils + + + %1 %2 + Title for dialogs + + + + + %1 <b>%3</b> %2? + Text for dialogs + + + + + Robomongo::DocumentTextEditor + + + Validate + + + + + Unable to parse JSON:<br /> <b>%1</b>, at (%2, %3). + + + + + Parsing error + + + + + Validation + + + + + JSON is valid! + + + + + Robomongo::EditIndexDialog + + + Index Properties + + + + + Basic + + + + + Advanced + + + + + Text Search + + + + + Unique + + + + + Drop duplicates + + + + + Choose any name that will help you to identify this index. + + + + + Document that contains pairs with the name of the field or fields to index and order of the index. A 1 specifies ascending and a -1 specifies descending. + + + + + If set, creates a unique index so that the collection will not accept insertion of documents where the index key or keys match an existing value in the index. + + + + + MongoDB cannot create a unique index on a field that has duplicate values. To force the creation of a unique index, you can specify the dropDups option, which will only index the first occurrence of a value for the key, and delete all subsequent values. + + + + + Name: + + + + + Keys: + + + + + Sparse + + + + + Create index in background + + + + + seconds + + + + + Expire after + + + + + If set, the index only references documents with the specified field. These indexes use less space but behave differently in some situations (particularly sorts). + + + + + Builds the index in the background so that building an index does not block other database activities. + + + + + Specifies a <i>time to live</i>, in seconds, to control how long MongoDB retains documents in this collection + + + + + For a <i>text</i> index, the language that determines the list of stop words and the rules for the stemmer and tokenizer. The default value is <b>english</b> + + + + + For a <i>text</i> index, specify the name of the field in the document that contains, for that document, the language to override the default language. The default value is <b>language</b> + + + + + Document that contains field and weight pairs. The weight is a number ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields. + + + + + Default language: + + + + + Language override: + + + + + Text weights + + + + + + Invalid json + + + + + + Please check json text. + + + + + + Robomongo::ExplorerCollectionDirIndexesTreeItem + + + + Add Index... + + + + + Drop Index... + + + + + Rebuild Indexes... + + + + + View Indexes + + + + + Refresh + + + + + Indexes + + + + + A unique index causes MongoDB to reject all documents that contain a duplicate value for the indexed field. + + + + + Sparse indexes only contain entries for documents that have the indexed field. + + + + + Robomongo::ExplorerCollectionIndexesTreeItem + + + Drop Index... + + + + + Edit Index... + + + + + Drop + + + + + Index + + + + + Robomongo::ExplorerCollectionTreeItem + + + Insert Document... + + + + + Update Documents... + + + + + Remove Documents... + + + + + Remove All Documents... + + + + + Statistics + + + + + Storage Size + + + + + Total Index Size + + + + + Total Size + + + + + Shard Version + + + + + Shard Distribution + + + + + Drop Collection... + + + + + Rename Collection... + + + + + Duplicate Collection... + + + + + Copy Collection to Database... + + + + + View Documents + + + + + Insert Document + + + + + Remove All Documents + + + + + Remove all documents from <b>%1</b> collection? + + + + + update only one document + + + + + insert a new document, if no existing document match the query + + + + + Drop + + + + + collection + + + + + Duplicate Collection + + + + + &Duplicate + + + + + + New Collection Name: + + + + + Rename Collection + + + + + &Rename + + + + + Robomongo::ExplorerDatabaseCategoryTreeItem + + + Create Collection... + + + + + Collections Statistics + + + + + + + Refresh + + + + + View Users + + + + + Add User... + + + + + View Functions + + + + + Add Function... + + + + + Create Collection + + + + + &Create + + + + + Collection Name: + + + + + Create Function + + + + + write your code here + + + + + Robomongo::ExplorerDatabaseTreeItem + + + Open Shell + + + + + Database Statistics + + + + + Drop Database... + + + + + Repair Database... + + + + + Refresh + + + + + + + Collections + + + + + + + Functions + + + + + + + Users + + + + + System + + + + + Drop <b>%1</b> database? + + + + + Drop Database + + + + + Robomongo::ExplorerFunctionTreeItem + + + Remove Function + + + + + + Edit Function + + + + + Drop + + + + + Function + + + + + Robomongo::ExplorerServerTreeItem + + + Open Shell + + + + + Refresh + + + + + Create Database + + + + + Server Status + + + + + MongoDB Version + + + + + Host Info + + + + + Show Log + + + + + + Disconnect + + + + + System + + + + + &Create + + + + + Database Name: + + + + + Robomongo::ExplorerUserTreeItem + + + Drop User + + + + + + Edit User + + + + + Drop + + + + + User + + + + + New Password: + + + + + Robomongo::FindFrame + + + Next + + + + + Previous + + + + + Match case + + + + + Search + + + + + The specified text was not found. + + + + + Robomongo::FunctionTextEditor + + + Name: + + + + + Code: + + + + + Robomongo::LogWidget + + + Clear All + + + + + Robomongo::MainWindow + + + &Open... + + + + + Load script from the file to the currently opened shell + + + + + &Save + + + + + Save &As... + + + + + &Exit + + + + + + &Connect... + + + + + Connect + + + + + &Rotate + + + + + Toggle orientation of results view <b>(F10)</b> + + + + + &Text Mode + + + + + Show current tab in text mode, and make this mode default for all subsequent queries <b>(F4)</b> + + + + + &Tree Mode + + + + + Show current tab in tree mode, and make this mode default for all subsequent queries <b>(F3)</b> + + + + + T&able Mode + + + + + Show current tab in table mode, and make this mode default for all subsequent queries <b>(F3)</b> + + + + + &Custom Mode + + + + + Show current tab in custom mode if possible, and make this mode default for all subsequent queries <b>(F2)</b> + + + + + Stop execution of currently running script. <b>(F6)</b> + + + + + Show Line Numbers By Default + + + + + Window + + + + + &Full Screen + + + + + Refresh + + + + + File + + + + + View + + + + + Options + + + + + Default View Mode + + + + + Display Dates In... + + + + + Auto Expand First Document + + + + + Do not decode (show as is) + + + + + Use Java Encoding + + + + + Use .NET Encoding + + + + + Use Python Encoding + + + + + Legacy UUID Encoding + + + + + Load .mongorc.js + + + + + Ctrl + + + + + Save script of the currently opened shell to the file <b>(%1 + S)</b> + + + + + + Connect to local or remote MongoDB instance <b>(%1 + O)</b> + + + + + Execute query for current tab. If you have some selection in query text - only selection will be executed <b>(F5 </b> or <b>%1 + Enter)</b> + + + + + Disable Connection Shortcuts + + + + + Preferences + + + + + &About Robomongo... + + + + + &Minimize + + + + + Select Next Tab + + + + + Select Previous Tab + + + + + Help + + + + + Toolbar + + + + + Open/Save ToolBar + + + + + Exec Toolbar + + + + + Theme + + + + + Language + + + + + System locale (if available) + Language based on system locale + + + + + + Logs + + + + + &Manage Connections... + + + + + Connect to MongoDB + + + + + + Cannot connect to MongoDB (%1) + + + + + + + Error + + + + + Refresh not working yet... : <br/> <b>Ctrl+D</b> : push Button + + + + + Cannot connect to MongoDB (%1), +error: %2 + + + + + Database Explorer + + + + + &Explorer + + + + + Press to show/hide Database Explorer panel. + + + + + &Logs + + + + + Robomongo::MongoWorker + + + Unable to authorize + + + + + Unable to connect to MongoDB + + + + + Unable to load database names. + + + + + Unable to load list of collections. + + + + + Unable to load list of users. + + + + + Unable to load list of functions. + + + + + Unable to insert document. + + + + + Unable to remove documents. + + + + + + Unable to complete query. + + + + + Unable to autocomplete query. + + + + + Unable to create database. + + + + + Unable to drop database. + + + + + Unable to create collection. + + + + + Unable to drop collection. + + + + + Unable to rename collection. + + + + + Unable to duplicate collection. + + + + + Unable to copy collection. + + + + + Unable to create/ovewrite user. + + + + + Unable to drop user. + + + + + Unable to create/ovewrite function. + + + + + Unable to drop function. + + + + + Robomongo::Notifier + + + Delete Document... + + + + + Delete Documents... + + + + + Edit Document... + + + + + View Document... + + + + + Insert Document... + + + + + Copy Value + + + + + Copy JSON + + + + + Cannot delete + + + + + Selected document doesn't have _id field. +Maybe this is a system document that should be managed in a special way? + + + + + + Delete + + + + + Document + + + + + %1 %2 with id:<br><b>%3</b>? + + + + + Do you want to delete %n selected documents? + + + + + + + + Edit Document + + + + + View Document + + + + + Insert Document + + + + + Robomongo::OutputItemContentWidget + + + %1 sec. + + + + + Loading... + + + + + Robomongo::OutputItemHeaderWidget + + + Maximize or restore back this output result. You also can double-click on result's header. + + + + + View results in text mode + + + + + View results in tree mode + + + + + View results in table mode + + + + + View results in custom UI + + + + + Robomongo::PagingWidget + + + Skip + + + + + Batch Size (number of documents shown at once) + + + + + Robomongo::QueryWidget + + + New Shell + + + + + Script executed successfully, but there are no results to show. + + + + + Robomongo::ScriptInfo + + + JavaScript (*.js);; All Files (*.*) + + + + + Save As + + + + + Robomongo::ScriptWidget + + + loading... + + + + + Robomongo::SettingsManager + + + + __LANGUAGE_NAME__ + Native language name: "English" for English, "Русский" for Russian etc. + English + + + + Robomongo::SshTunelTab + + + Use SSH tunnel + + + + + + Password + + + + + + Private Key + + + + + User Password: + + + + + Private key: + + + + + Passphrase: + + + + + SSH Address: + + + + + SSH User Name: + + + + + SSH Auth Method: + + + + + Select private key file + + + + + Private key files (*.*) + + + + + Robomongo::WorkAreaTabBar + + + &New Shell + + + + + &Reload + + + + + &Duplicate + + + + + &Pin Shell + + + + + &Close Shell + + + + + Close &Other Shells + + + + + Close Shells to the R&ight + + + + + Robomongo::WorkAreaTabWidget + + + Loading... + + + + + loadFromFileText + + + Error + + + + + can't read from %1: +%2. + + + + + parseDocument + + + Array [%1] + + + + + { %n fields } + + { %n field } + { %n fields } + + + + + saveToFileText + + + Error + + + + + can't save to %1: +%2. + + + + diff --git a/src/robomongo/lang/robomongo_pt.ts b/src/robomongo/lang/robomongo_pt.ts new file mode 100644 index 000000000..a0f538b0f --- /dev/null +++ b/src/robomongo/lang/robomongo_pt.ts @@ -0,0 +1,2005 @@ + + + + + QObject + + JavaScript (*.js);; All Files (*.*) + JavaScript (*.js);; Todos os Arquivos (*.*) + + + Error + Erro + + + can't read from %1: +%2. + impossível ler de %1: %2. + + + can't save to %1: +%2. + impossível salvar para %1: +%2. + + + Save As + Salvar como + + + Array [%1] + Array[%1] + + + { %n fields } + + { %n campo } + { %n campos } + + + + Private key files (*.*) + Arquivos de chaves privadas (*.*) + + + + Robomongo::AboutDialog + + + About + Sobre + + + + Shell-centric MongoDB management tool. + Need better approach. + Ferramenta de administração MongoDB centralizada em shell. + + + + Visit %1 %2 + project title, 'website' word + Visite %1, %2 + + + + website + site + + + + Fork + Fork + + + + project or + Projeto ou + + + + submit + envie + + + + issues/proposals on GitHub. + problemas/sugestões para o GitHub. + + + + All rights reserved + Todos os Direitos Reservados + + + + The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + O programa é fornecido TAL COMO ESTÁ SEM GARANTIA DE QUALQUER ESPÉCIE, INCLUINDO A GARANTIA DE DESIGN, COMERCIALIZAÇÃO E ADEQUAÇÃO A UM DETERMINADO FIM. + + + + Robomongo::BsonTreeModel + + + (%1) %2 + (%1) %2 + + + + { %n fields } + + { %n campo } + { %n campos } + + + + + Key + Chave + + + + Value + Valor + + + + Type + Tipo + + + + Robomongo::BsonTreeView + + + Expand Recursively + Expandir Recursivamente + + + + Robomongo::CollectionStatsTreeWidget + + + Name + Nome + + + + Count + Need to verify the usage + Quantidade + + + + Size + Tamanho + + + + Storage + Armazenamento + + + + Index + Índice + + + + Average Object + Objeto médio + + + + Padding + Needs to verify the usage. + Espaçamento + + + + Robomongo::ConnectionAdvancedTab + + + Database, that will be default (<code>db</code> shell variable will point to this database). By default, default database will be the one you authenticate on, or <code>test</code> otherwise. Leave this field empty, if you want default behaviour. + Banco de dados, que será padrão(<code>db</code> variável do shell que aponta para este banco de dados). Por padrão, o banco de dados padão será o que você autenticou, ou <code>test</code> caso contrário. Deixe este campo em branco, se você deseja o comportamento padrão. + + + + Default Database: + Banco de dados padrão: + + + + Robomongo::ConnectionAuthTab + + + <nobr>The <code>admin</code> database is unique in MongoDB.</nobr> Users with normal access to the <code>admin</code> database have read and write access to <b>all databases</b>. + <nobr>O<code>admin</code> database is unique in MongoDB.</nobr> Users with normal access to the <code>admin</code> database have read and write access to <b>all databases</b>. + + + + User Name + Usuário + + + + Password + Senha + + + + Database + Banco de dados + + + + Perform authentication + Executar autenticação + + + + + Show + Mostrar + + + + Hide + Esconder + + + + Robomongo::ConnectionBasicTab + + + Choose any connection name that will help you to identify this connection. + Escolha um nome que irá ajudar você identificar esta conexão. + + + + Specify host and port of MongoDB server. Host can be either IP or domain name. + Especifique o host e a porta do Servidor MongoDB. Host pode ser IP ou domínio. + + + + Name: + Nome: + + + + Address: + Endereço: + + + + Robomongo::ConnectionDiagnosticDialog + + + Diagnostic + Diagnóstico + + + + &Close + &Fechar + + + + Connecting to <b>%1</b>... + Conectando com <b>%1</b> ... + + + + Authorizing on <b>%1</b> database as <b>%2</b>... + Autenticando banco de dados <b>%1</b> como <b>%2</b>... + + + + + Authorization skipped by you + Você pulou a autenticação + + + + Connected to <b>%1</b> + Conectado com <b>%1</b> + + + + Unable to connect to <b>%1</b> + Não foi possível conectar com <b> %1</b> + + + + Authorized as <b>%1</b> + Autenticado como <b>%1</b> + + + + Authorization failed + Autenticação falhou + + + + Robomongo::ConnectionDialog + + + Connection Settings + Configurações de Conexão + + + + Connection + Conexão + + + + Authentication + Autenticação + + + + Advanced + Avançado + + + + Invalid Transport + Transporte Inválido + + + + SSH and SSL cannot be enabled simultaneously. Please uncheck one of them. + SSH e SSL não podem ser ativados simultâneamente. Por favor desmarque um deles. + + + + Robomongo::ConnectionSslTab + + + Use SSL protocol + Use protocolo SSL + + + + SSL Certificate: + Certificado SSL: + + + + <nobr>SSL Certificate and SSL Private Key combined into one file (*.pem) + <nobr>Certificado e chave privada SSL combinados em um só arquivo (*.pem) + + + + <b>Note:</b> Support for Certificate Authority (CA) file and encrypted SSL Private Keys are planned for future releases. + <b>Nota:</b> Suporte para arquivo de Certificado de Autorização (CA) e Chaves privadas SSL encriptadas estão planejados para proximas versões. + + + + Select SSL Key File (PEM) + Selecione o arquivo de Chave SSL (PEM) + + + + PEM files (*.pem) + Arquivos PEM (*.pem) + + + + Robomongo::ConnectionsDialog + + + MongoDB Connections + Conexões MongoDB + + + + &Add... + &Adicionar... + + + + &Edit... + &Editar... + + + + &Clone... + &Clonar... + + + + &Remove... + &Remover... + + + + Name + Nome + + + + Address + Endereço + + + + Auth. Database / User + Autenticação Banco de dados/Usuário + + + + C&onnect + C&onectar + + + + Create + Criar + + + + edit + editar + + + + remove + remover + + + + clone + clonar + + + + or reorder connections via drag'n'drop. + ou re-ordenar conexões arrastando. + + + + Connections + Conexões + + + + Really delete "%1" connection? + Tem certeza que deseja deletar a conexão: %1 ? + + + + Copy of %1 + Cópia de %1 + + + + Robomongo::CopyCollection + + + Copy Collection + Coleção de cópia + + + + Copy + Cópia + + + + Select server: + Servidor Selecionado: + + + + Copy <b>%1</b> collection to database on this or another server. You need to be already connected to destination server, in order to see this server in the list below. This operation will <i>not</i> overwrite existing documents with the same _id. + Copie a coleção <b>%1</b> para o banco de dados neste ou em outro servidor. Você precisa já estar conectado ao servidor de destino para poder ver o mesmo na lista abaixo. Esta operação <b>não</b> sobrescreverá quaisquer documentos existentes com o mesmo _id. + + + + Select database: + Selecione o banco de dados: + + + + Robomongo::CreateDatabaseDialog + + + Create Database + Criar Banco de dados + + + + Database Name: + Nome do Banco de dados: + + + + C&reate + C&riar + + + + Robomongo::CreateUserDialog + + + + Add User + Adicionar Usuário + + + + + Name: + Nome: + + + + + Password: + Senha: + + + + UserSource: + Usuário Origem: + + + + Read Only + Somente leitura + + + + Invalid input + Entrada Inválida + + + + The UserSourse field and the Password field are mutually exclusive. The document cannot contain both. + + Os campos Usuário Origem e Senha são mutualmente exclusivos. O documento não pode conter ambos. + + + + + Robomongo::DialogUtils + + + %1 %2 + Title for dialogs + + + + + %1 <b>%3</b> %2? + Text for dialogs + + + + + Robomongo::DocumentTextEditor + + + Validate + Validar + + + + Unable to parse JSON:<br /> <b>%1</b>, at (%2, %3). + Não foi possível analisar JSON<br /> <b>%1</b>, em (%2, %3). + + + + Parsing error + Erro de varredura + + + + Validation + Validação + + + + JSON is valid! + JSON é valido! + + + + Robomongo::EditIndexDialog + + + Index Properties + Propriedades do Índice + + + + Basic + Básico + + + + Advanced + Avançado + + + + Text Search + Pesquisa Textual + + + + Unique + Único + + + + Drop duplicates + Excluir duplicatas + + + + Choose any name that will help you to identify this index. + Escolha um nome que irá lhe ajudar a identificar este índice. + + + + Document that contains pairs with the name of the field or fields to index and order of the index. A 1 specifies ascending and a -1 specifies descending. + Documento que contém pares com o nome do campo ou campos de índice e da ordem do índice. O 1 especifica ascendente e um-1 especifica descendente. + + + + If set, creates a unique index so that the collection will not accept insertion of documents where the index key or keys match an existing value in the index. + Se setado, cria um índice único para que a coleção não aceite inserção de documentos onde a chave primária ou chaves primárias sejam iguais a um outro valor no índice. + + + + MongoDB cannot create a unique index on a field that has duplicate values. To force the creation of a unique index, you can specify the dropDups option, which will only index the first occurrence of a value for the key, and delete all subsequent values. + MongoDB não pode criar um índice único em um campo que possui valores duplicados. Para forçar a criação do índice único, você pode especificar com a opção "dropDups", que somente indexará a primeira ocorrência de um valor para a chave, e irá deletar os valores subsequentes. + + + + Name: + Nome: + + + + Keys: + Chaves: + + + + Sparse + Espaçado + + + + Create index in background + Criar índice em background + + + + seconds + segundos + + + + Expire after + Expira após + + + + If set, the index only references documents with the specified field. These indexes use less space but behave differently in some situations (particularly sorts). + Se setado, o índice irá somente referenciar documentos com o campo especificado. Estes índices usam menos espaço mas se comportam de uma forma diferente em algumas situações( particularmente ordenações ). + + + + Builds the index in the background so that building an index does not block other database activities. + Constrói o índice em background para que a construção de um índice não bloqueia outras atividades do banco de dados. + + + + Specifies a <i>time to live</i>, in seconds, to control how long MongoDB retains documents in this collection + Especifica o <i> tempo </i> em segundos, para controlar quanto tempo MongoDB retém documentos nesta conexão + + + + For a <i>text</i> index, the language that determines the list of stop words and the rules for the stemmer and tokenizer. The default value is <b>english</b> + Para um <i> índice textual </i>, a linguagem que determina a lista de palavars de parada e as regras para stemmer e o tokenizador. O valor padrão é <b> english </b> + + + + For a <i>text</i> index, specify the name of the field in the document that contains, for that document, the language to override the default language. The default value is <b>language</b> + Para um <i> índice textual </i>, especifique o nome do campo do documento que contém, para um documento, a linguagem para sobrescrever a linguagem padrão. O valor padrão é <b> language </b> + + + + Document that contains field and weight pairs. The weight is a number ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields. + Documento que contém campo e pares de peso. O peso e um número, variando de 1 até 99,999 que indica o significado do campo relativo para outros campos indexados. + + + + Default language: + Linguagem padrão: + + + + Language override: + Linguagem para sobrescrever: + + + + Text weights + Pesos do texto + + + + + Invalid json + JSON Inválido + + + + + Please check json text. + + Por favor verifique o JSON. + + + + + Robomongo::ExplorerCollectionDirIndexesTreeItem + + + + Add Index... + Adicionar índice... + + + + Drop Index... + Dropar índice... + + + + Rebuild Indexes... + Recriar índices... + + + + View Indexes + Ver índices + + + + Refresh + Atualizar + + + + Indexes + Índices + + + + A unique index causes MongoDB to reject all documents that contain a duplicate value for the indexed field. + Um índice único faz com que MongoDB rejeite todos os documentos qyue contém um valor duplicado de campo indexado. + + + + Sparse indexes only contain entries for documents that have the indexed field. + Índices com espaçamento somente contém entradas para documents que tem campo indexado. + + + + Robomongo::ExplorerCollectionIndexesTreeItem + + + Drop Index... + Dropar índice... + + + + Edit Index... + Editar Índice... + + + + Drop + Dropar + + + + Index + Índice + + + + Robomongo::ExplorerCollectionTreeItem + + + Insert Document... + Inserir documento... + + + + Update Documents... + Atualizar documento... + + + + Remove Documents... + Remover documento... + + + + Remove All Documents... + Remover todos os Documentos... + + + + Statistics + Estatísticas + + + + Storage Size + Tamanho de Armazenamento + + + + Total Index Size + Tamanho total de índice + + + + Total Size + Tamanho total + + + + Shard Version + Shard versão + + + + Shard Distribution + Shard Distribuição + + + + Drop Collection... + Dropar Coleção... + + + + Rename Collection... + Renomear Coleção... + + + + Duplicate Collection... + Duplicar Coleção... + + + + Copy Collection to Database... + Copiar coleção para o banco de dados... + + + + View Documents + Ver Documentos + + + + Insert Document + Inserir Documentos + + + + Remove All Documents + Remover todos os documentos + + + + Remove all documents from <b>%1</b> collection? + Remover todos os documentos da coleção <b>%1</b> ? + + + + update only one document + atualizar somente um documento + + + + insert a new document, if no existing document match the query + inserir um novo documento, se não existir nenhum documento que seja igual a query + + + + Drop + Dropar + + + + collection + coleção + + + + Duplicate Collection + Duplicar conexão + + + + &Duplicate + &Duplicar + + + + + New Collection Name: + Novo nome de coleção: + + + + Rename Collection + Renomar coleção + + + + &Rename + &Renomear + + + + Robomongo::ExplorerDatabaseCategoryTreeItem + + + Create Collection... + Criar coleção... + + + + Collections Statistics + Estatísticas de coleções + + + + + + Refresh + Atualizar + + + + View Users + Ver Usuários + + + + Add User... + Adicionar Usuário... + + + + View Functions + Ver funções + + + + Add Function... + Adicionar Funções... + + + + Create Collection + Criar Coleção + + + + &Create + &Criar + + + + Collection Name: + Nome da coleção: + + + + Create Function + Criar função + + + + write your code here + escreva seu código aqui + + + + Robomongo::ExplorerDatabaseTreeItem + + + Open Shell + Abrir Terminal + + + + Database Statistics + Estatísticas de banco de dados + + + Drop Database.. + Dropar banco de dados.. + + + + Drop Database... + Dropar banco de dados... + + + + Repair Database... + Reparar Banco de dados... + + + + Refresh + Atualizar + + + + + + Collections + Coleções + + + + + + Functions + Funções + + + + + + Users + Usuários + + + + System + Sistema + + + + Drop <b>%1</b> database? + Dropar banco de dados <b> %1 </b> ? + + + + Drop Database + Dropar banco de dados + + + + Robomongo::ExplorerFunctionTreeItem + + + Remove Function + Remover Função + + + + + Edit Function + Editar função + + + + Drop + Dropar + + + + Function + Função + + + + Robomongo::ExplorerServerTreeItem + + + Open Shell + Abrir Terminal + + + + Refresh + Atualizar + + + + Create Database + Criar banco de dados + + + + Server Status + Status do servidor + + + + MongoDB Version + Versão do MongoDB + + + + Host Info + Informações do Host + + + + Show Log + Mostrar Log + + + + + Disconnect + Desconectar + + + + System + Sistema + + + + &Create + &Criar + + + + Database Name: + Nome do Banco de Dados: + + + + Robomongo::ExplorerUserTreeItem + + + Drop User + Dropar Usuário + + + + + Edit User + Editar Usuário + + + + Drop + Dropar + + + + User + Usuário + + + + New Password: + Nova senha: + + + + Robomongo::FindFrame + + + Next + Próximo + + + + Previous + Anterior + + + + Match case + Deferenciar maíusculas de minúsculas + + + + Search + Pesquisar + + + + The specified text was not found. + O texto específico não foi encontrado. + + + + Robomongo::FunctionTextEditor + + + Name: + Nome: + + + + Code: + Código: + + + + Robomongo::LogWidget + + + Clear All + Limpar tudo + + + + Robomongo::MainWindow + + + &Open... + &Abrir... + + + + Load script from the file to the currently opened shell + Carregar o script do arquivo para o shell aberto + + + + &Save + &Salvar + + + + Save &As... + Salvar &Como... + + + + &Exit + &Fechar + + + + + &Connect... + C&onectar... + + + + Connect + Conectar + + + + &Rotate + Gi&rar + + + + Toggle orientation of results view <b>(F10)</b> + Alternar orientação da visualização dos resultados <b>F10</b> + + + + &Text Mode + Modo &Texto + + + + Show current tab in text mode, and make this mode default for all subsequent queries <b>(F4)</b> + Mostrar a aba ativa no modo texto, e tornar este modo padrão para todas as queries subsequentes <b>(F4)</b> + + + + &Tree Mode + &Modo Árvore + + + + Show current tab in tree mode, and make this mode default for all subsequent queries <b>(F3)</b> + Mostrar a aba ativa no modo árvore, e tornar este modo padrão para todas as queries subsequentes <b>(F3)</b> + + + + T&able Mode + Modo Ta&bela + + + + Show current tab in table mode, and make this mode default for all subsequent queries <b>(F3)</b> + Mostrar a aba ativa no modo tabela, e tornar este modo padrão para todas as queries subsequentes <b>(F3)</b> + + + + &Custom Mode + Modo C&ustomizado + + + + Show current tab in custom mode if possible, and make this mode default for all subsequent queries <b>(F2)</b> + Mostrar a aba ativa no modo customizado se possível, e tornar este modo padrão para todas as queries subsequentes <b>(F2)</b> + + + + Stop execution of currently running script. <b>(F6)</b> + Parar a execução do script.<b>(F6)</b> + + + + Show Line Numbers By Default + + + + + Window + + + + + &Full Screen + Tela C&heia + + + + Refresh + Atualizar + + + + File + Arquivo + + + + View + Visualização + + + + Options + Opções + + + + Default View Mode + Modo de visualização padrão + + + + Display Dates In... + Mostrar datas em... + + + + Auto Expand First Document + Auto expandir primeiro documento + + + + Do not decode (show as is) + Não decodificar(mostrar como esta) + + + + Use Java Encoding + Usar codificação do Java + + + + Use .NET Encoding + Usar codificação do .NET + + + + Use Python Encoding + Usar codificação do Python + + + + Legacy UUID Encoding + Usar codificação UUID Legacy + + + + Load .mongorc.js + Carregar .mongorc.js + + + + Ctrl + Ctrl + + + + Save script of the currently opened shell to the file <b>(%1 + S)</b> + Salvar o script do shell aberto para o arquivo <b>(%1 + S)</b> + + + + + Connect to local or remote MongoDB instance <b>(%1 + O)</b> + Conectar a uma instância local ou remota do MongoDB <b>(%1 + O)</b> + + + + Execute query for current tab. If you have some selection in query text - only selection will be executed <b>(F5 </b> or <b>%1 + Enter)</b> + Executar query da aba atual. Se você tiver algo selecionado, somente a seleção será executada <b>(F5 </b> or <b>%1 + Enter)</b> + + + + Disable Connection Shortcuts + Desabilitar atalhos de conexão + + + + Preferences + Preferências + + + + &About Robomongo... + So&bre Robomongo... + + + + &Minimize + + + + + Select Next Tab + + + + + Select Previous Tab + + + + + Help + Ajuda + + + + Toolbar + Barra de Ferramentar + + + + Open/Save ToolBar + Abrir/Salvar Barra de Ferramentas + + + + Exec Toolbar + + + + + Theme + Tema + + + + Language + Idioma + + + + System locale (if available) + Language based on system locale + Localidade do sistema(se disponível) + + + + + Logs + Logs + + + + &Manage Connections... + Ad&ministrar Conexões... + + + + Connect to MongoDB + Conectar com MongoDB + + + + + Cannot connect to MongoDB (%1) + Não foi possível conectar com MongoDB (%1) + + + + + + Error + Erro + + + + Refresh not working yet... : <br/> <b>Ctrl+D</b> : push Button + Atualizar não esta funcionando ainda... : <br/> <b>Ctrl+D</b> : push Button + + + + Cannot connect to MongoDB (%1), +error: %2 + Não foi possível conectar com MongoDB (%1), +Erro: %2 + + + + Database Explorer + Explorador + + + + &Explorer + &Explorador + + + + Press to show/hide Database Explorer panel. + Pressione para mostrar/esconder painel de Explorador. + + + + &Logs + &Logs + + + + Robomongo::MongoWorker + + + Unable to authorize + Impossível autenticar + + + + Unable to connect to MongoDB + Impossível conectar com o MongoDB + + + + Unable to load database names. + Impossível carregar nomes dos bancos de dados. + + + + Unable to load list of collections. + Impossível carregar lista de coleções. + + + + Unable to load list of users. + Impossível carregar lista de usuários. + + + + Unable to load list of functions. + Impossível carregar lista de funções. + + + + Unable to insert document. + Impossível inserir documento. + + + + Unable to remove documents. + Impossível remover documentos. + + + + + Unable to complete query. + Impossível completar a query. + + + + Unable to autocomplete query. + Impossível autocompletar a query. + + + + Unable to create database. + Impossível criar banco de dados. + + + + Unable to drop database. + Impossível dropar banco de dados. + + + + Unable to create collection. + Impossível criar coleção. + + + + Unable to drop collection. + Impossível dropar coleção. + + + + Unable to rename collection. + Impossível renomear coleção. + + + + Unable to duplicate collection. + Impossível duplicar coleção. + + + + Unable to copy collection. + Impossível copiar coleção. + + + + Unable to create/ovewrite user. + Impossível criar/sobrescrever usuário. + + + + Unable to drop user. + Impossível dropar usuário. + + + + Unable to create/ovewrite function. + Impossível criar/sobrescrever função. + + + + Unable to drop function. + Impossível dropar função. + + + + Robomongo::Notifier + + + Delete Document... + Deletar Documento... + + + + Delete Documents... + Deletar Documentos... + + + + Edit Document... + Editar Documento... + + + + View Document... + Ver documento... + + + + Insert Document... + Inserir documento... + + + + Copy Value + Copiar valor + + + + Copy JSON + Copiar JSON + + + + Cannot delete + Impossível deletar + + + + Selected document doesn't have _id field. +Maybe this is a system document that should be managed in a special way? + Documento selecionado não tem o campo _id +Este é um sistema de documentos que precisa ser gerenciado de forma especial? + + + + + Delete + Deletar + + + + Document + Documento + + + + %1 %2 with id:<br><b>%3</b>? + + + + + Do you want to delete %n selected documents? + + Você quer deletar %n documento selecionados? + Você quer deletar %n documentos selecionados? + + + + + Edit Document + Editar documento + + + + View Document + Ver documento + + + + Insert Document + Inserir documento + + + + Robomongo::OutputItemContentWidget + + + %1 sec. + %1 sec. + + + + Loading... + Carregando... + + + + Robomongo::OutputItemHeaderWidget + + + Maximize or restore back this output result. You also can double-click on result's header. + Maximizar ou restaurar esta saída de resultados. Você pode também dar um duplo clique no cabeçalho dos resultados. + + + + View results in text mode + Ver resultados em modo texto + + + + View results in tree mode + Ver resultados em modo árvore + + + + View results in table mode + Ver resultados em modo tabela + + + + View results in custom UI + Ver resultados em modo customizado + + + + Robomongo::PagingWidget + + + Skip + Pular + + + + Batch Size (number of documents shown at once) + Tamanho do Batch (número de documentos mostrados de uma só vez) + + + + Robomongo::QueryWidget + + + New Shell + Novo Shell + + + + Script executed successfully, but there are no results to show. + + + + Script executed successfully, but there is no results to show. + Script executado com sucesso, mas não há resultados para mostrar. + + + + Robomongo::ScriptInfo + + + JavaScript (*.js);; All Files (*.*) + JavaScript (*.js);; Todos os Arquivos (*.*) + + + + Save As + Salvar como + + + + Robomongo::ScriptWidget + + + loading... + carregando... + + + + Robomongo::SettingsManager + + + + __LANGUAGE_NAME__ + Native language name: "English" for English, "Русский" for Russian etc. + Brazilian Portuguese + + + + Robomongo::SshTunelTab + + + Use SSH tunnel + Use Túnel SSH + + + + + Password + Senha + + + + + Private Key + Chave Privada + + + + User Password: + + + + + Private key: + + + + + Passphrase: + + + + + SSH Address: + + + + + SSH User Name: + + + + + SSH Auth Method: + + + + + Select private key file + Selecione o arquivo de chave privada + + + + Private key files (*.*) + Arquivos de chaves privadas (*.*) + + + + Robomongo::WorkAreaTabBar + + + &New Shell + &Novo Terminal + + + + &Reload + &Recarregar + + + + &Duplicate + &Duplicar + + + + &Pin Shell + &Fixar Terminal + + + + &Close Shell + &Fechar Terminal + + + + Close &Other Shells + Fechar &Outros Terminais + + + + Close Shells to the R&ight + Fechar Terminais a di&reita + + + + Robomongo::WorkAreaTabWidget + + + Loading... + Carregando... + + + + loadFromFileText + + + Error + Erro + + + + can't read from %1: +%2. + impossível ler de %1: +%2. + + + + parseDocument + + + Array [%1] + Array [%1] + + + + { %n fields } + + { %n campo } + { %n campos } + + + + + saveToFileText + + + Error + Erro + + + + can't save to %1: +%2. + impossível salvar para %1: +%2. + + + diff --git a/src/robomongo/lang/robomongo_ru.ts b/src/robomongo/lang/robomongo_ru.ts new file mode 100644 index 000000000..c469b9e98 --- /dev/null +++ b/src/robomongo/lang/robomongo_ru.ts @@ -0,0 +1,2003 @@ + + + + + QObject + + JavaScript (*.js);; All Files (*.*) + JavaScript (*.js);; Все файлы (*.*) + + + Error + Ошибка + + + can't read from %1: +%2. + Не удаётся прочитать %1: +%2. + + + can't save to %1: +%2. + Не удаётся сохранить %1: +%2. + + + Save As + Сохранить как + + + Array [%1] + Массив [%1] + + + { %n fields } + + { %n поле} + { %n поля} + { %n полей } + + + + Private key files (*.*) + Файлы закрытых ключей (*.*) + + + + Robomongo::AboutDialog + + + About + О + + + + Shell-centric MongoDB management tool. + Консоль-ориентированный инструмент управления MongoDB. + + + + website + сайт + + + + Visit %1 %2 + project title, 'website' word + Посетите %2 %1 + + + + Fork + Клонируйте + + + + project or + проект или + + + + submit + отправьте + + + + issues/proposals on GitHub. + вопросы/предложения на GitHub. + + + + The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + Программа предоставляется КАК ЕСТЬ БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, БЕЗ ГАРАНТИЙ ДИЗАЙНА, КОММЕРЧЕСКИХ ГАРАНТИЙ И ГАРАНТИЙ ПРИГОДНОСТИ ДЛЯ КОНКРЕТНЫХ ЗАДАЧ. + + + + All rights reserved + Все права защищены + + + + Robomongo::BsonTreeModel + + + (%1) %2 + (%1) %2 + + + + { %n fields } + + { %n поле} + { %n поля} + { %n полей } + + + + + Key + Поле + + + + Value + Значение + + + + Type + Тип + + + + Robomongo::BsonTreeView + + + Expand Recursively + Рекурсивно развернуть + + + + Robomongo::CollectionStatsTreeWidget + + + Name + Имя + + + + Count + Количество + + + + Size + Размер + + + + Storage + На диске + + + + Index + Индекс + + + + Average Object + Средний размер объекта + + + + Padding + Заполнение + + + + Robomongo::ConnectionAdvancedTab + + + Database, that will be default (<code>db</code> shell variable will point to this database). By default, default database will be the one you authenticate on, or <code>test</code> otherwise. Leave this field empty, if you want default behaviour. + База данных по умолчанию (переменная <code>db</code> в консоли будет указывать на эту базу). Изначально базой по умолчанию будет та, которая служит для аутентификации, или <code>test</code>, если аутентификация не выполнялась. Оставьте это поле пустым, если описанное поведение программы вас устраивает. + + + + Default Database: + База данных по умолчанию: + + + + Robomongo::ConnectionAuthTab + + + <nobr>The <code>admin</code> database is unique in MongoDB.</nobr> Users with normal access to the <code>admin</code> database have read and write access to <b>all databases</b>. + <nobr>База данных <code>admin</code> уникальна в MongoDB.</nobr> Пользователи с нормальным доступом к базе <code>admin</code> имеют права на чтение и запись во <b>все базы</b>. + + + + User Name + Имя пользователя + + + + Password + Пароль + + + + Database + База данных + + + + Perform authentication + Пройти аутентификацию + + + + + Show + Показать + + + + Hide + Спрятать + + + + Robomongo::ConnectionBasicTab + + + Choose any connection name that will help you to identify this connection. + Введите любое имя, которое поможет вам понять что это за подключение. + + + + Specify host and port of MongoDB server. Host can be either IP or domain name. + Укажите хост и порт сервера MongoDB. Хост может быть как IP-адресом, так и доменным именем. + + + + Name: + Имя: + + + + Address: + Адрес: + + + + Robomongo::ConnectionDiagnosticDialog + + + Diagnostic + Диагностика + + + + &Close + &Закрыть + + + + Connecting to <b>%1</b>... + Подключение к <b>%1</b>... + + + + Authorizing on <b>%1</b> database as <b>%2</b>... + Авторизация для доступа к базе <b>%1</b> как <b>%2</b>... + + + + + Authorization skipped by you + Вы отказались от авторизации + + + + Connected to <b>%1</b> + Подключено к <b>%1</b> + + + + Unable to connect to <b>%1</b> + Не удалось подключиться к <b>%1</b> + + + + Authorized as <b>%1</b> + Авторизован как <b>%1</b> + + + + Authorization failed + Не удалось авторизоваться + + + + Robomongo::ConnectionDialog + + + Connection Settings + Настройки подключения + + + + Connection + Подключение + + + + Authentication + Аутентификация + + + + Advanced + Дополнительно + + + + Invalid Transport + Неверный протокол + + + + SSH and SSL cannot be enabled simultaneously. Please uncheck one of them. + SSH и SSL не могут быть активированы одновременно. Выберите, пожалуйста, что-то одно. + + + + Robomongo::ConnectionSslTab + + + Use SSL protocol + Использовать протокол SSL + + + + SSL Certificate: + SSL сертификат: + + + + <nobr>SSL Certificate and SSL Private Key combined into one file (*.pem) + <nobr>Сертификат и закрытый ключ SSL, скомбинированные в одном файле (*.pem) + + + + <b>Note:</b> Support for Certificate Authority (CA) file and encrypted SSL Private Keys are planned for future releases. + <b>Примечание:</b> Поддержка файлов сертификатов (CA) и шифрованных закрытых ключей SSL запланирована в будущих выпусках. + + + + Select SSL Key File (PEM) + Выберите файл ключа SSL (PEM) + + + + PEM files (*.pem) + PEM файлы (*.pem) + + + + Robomongo::ConnectionsDialog + + + MongoDB Connections + Подключения к MongoDB + + + + &Add... + &Добавить... + + + + &Edit... + &Править... + + + + &Clone... + С&копировать... + + + + &Remove... + &Удалить... + + + + Name + Имя + + + + Address + Адрес + + + + Auth. Database / User + База аутентификации / Пользователь + + + + C&onnect + Подклю&чить + + + + Create + Создайте + + + + edit + измените + + + + remove + удалите + + + + clone + скопируйте + + + + or reorder connections via drag'n'drop. + или переупорядчьте подключения, перетаскивая их. + + + + Connections + Подключения + + + + Really delete "%1" connection? + Действительно удалить подключение %1? + + + + Copy of %1 + Копия %1 + + + + Robomongo::CopyCollection + + + Copy Collection + Копировать коллекцию + + + + Copy + Копировать + + + + Select server: + Выберите сервер: + + + + Copy <b>%1</b> collection to database on this or another server. You need to be already connected to destination server, in order to see this server in the list below. This operation will <i>not</i> overwrite existing documents with the same _id. + Копировать коллекцию <b>%1</b> в базу данных на этом же или на другом сервере. Вы должны быть уже подключены к серверу назначения, чтобы увидеть его в списке ниже. Эта операция <i>не</i> перепишет существующие документы с такими же _id. + + + + Select database: + Выберите базу данных: + + + + Robomongo::CreateDatabaseDialog + + + Create Database + Создать базу данных + + + + Database Name: + Имя базы данных: + + + + C&reate + Соз&дать + + + + Robomongo::CreateUserDialog + + + + Add User + Добавить пользователя + + + + + Name: + Имя: + + + + + Password: + Пароль: + + + + UserSource: + Источник авторизации: + + + + Read Only + Только чтение + + + + Invalid input + Неверные входные данные + + + + The UserSourse field and the Password field are mutually exclusive. The document cannot contain both. + + Поля UserSourse и пароль взаимоисключающие. Запись не может содержать оба этих поля. + + + + Robomongo::DialogUtils + + + %1 %2 + Title for dialogs + %1 %2 + + + + %1 <b>%3</b> %2? + Text for dialogs + %1 %2 <b>%3</b>? + + + + Robomongo::DocumentTextEditor + + + Validate + Проверить + + + + Unable to parse JSON:<br /> <b>%1</b>, at (%2, %3). + Не удаётся разобрать JSON:<br /> <b>%1</b>, на (%2, %3). + + + + Parsing error + Ошибка разбора + + + + Validation + Проверка + + + + JSON is valid! + JSON корректен! + + + + Robomongo::EditIndexDialog + + + Index Properties + Свойства индекса + + + + Basic + Основное + + + + Advanced + Дополнительно + + + + Text Search + Поиск по тексту + + + + Unique + Уникальный + + + + Drop duplicates + Удалить дубликаты + + + + Choose any name that will help you to identify this index. + Выберите любое имя, которое поможет вам понять что этот за индекс. + + + + Document that contains pairs with the name of the field or fields to index and order of the index. A 1 specifies ascending and a -1 specifies descending. + Документ, содержащий пары, состоящие из имени поля и порядка индексирования по нему. <b>1</b> означает по возрастанию, а <b>-1</b> &mdash; по убыванию. + + + + If set, creates a unique index so that the collection will not accept insertion of documents where the index key or keys match an existing value in the index. + Если выбрано, создаёт уникальный индекс, в результате чего вставка в коллекцию документов, значения индексируемых полей которых уже имеются в индексе, будет невозможна. + + + + MongoDB cannot create a unique index on a field that has duplicate values. To force the creation of a unique index, you can specify the dropDups option, which will only index the first occurrence of a value for the key, and delete all subsequent values. + MongoDB не сможет создать уникальный индекс по полю, значения которого повторяются в пределах коллекции. Чтобы принудительно создать индекс в такой ситуации, вы можете использовать опцию <b>dropDups</b>. В этом случае первый документ, содержащий повторяющееся значение поля, будет проиндексирован, а остальные будут удалены. + + + + Name: + Имя: + + + + Keys: + Ключ: + + + + Sparse + Частичный + + + + Create index in background + Создать индекс в фоне + + + + seconds + секунд + + + + Expire after + Удалять после + + + + If set, the index only references documents with the specified field. These indexes use less space but behave differently in some situations (particularly sorts). + Если выбрано, индексируются только те документы, в которых указанное поле существует. Такой индекс занимает меньше места, но ведет себя по-разному в разных ситуациях (в частности при сортировках). + + + + Builds the index in the background so that building an index does not block other database activities. + Строит индекс в фоне, и его построение не блокирует остальные процессы базы данных. + + + + Specifies a <i>time to live</i>, in seconds, to control how long MongoDB retains documents in this collection + Указывает <i>время жизни</i>, в секундах, для определения как долго MongoDB будет хранить документы в этой коллекции + + + + For a <i>text</i> index, the language that determines the list of stop words and the rules for the stemmer and tokenizer. The default value is <b>english</b> + Для <i>текстового</i> индекса, язык, определяющий список стоп-слов и правила для стеммера и лексера. Значение по умолчанию <b>english</b> (английский) + + + + For a <i>text</i> index, specify the name of the field in the document that contains, for that document, the language to override the default language. The default value is <b>language</b> + Для <i>текстового</i> индекса, указывает имя поля в документе, которое содержит язык данного документа, переопределяющий язык по умолчанию. Значение по умолчанию <b>language</b> + + + + Document that contains field and weight pairs. The weight is a number ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields. + Документ, содержащий пары полей и весов. Вес &mdash; число в диапазоне от 1 до 99999, определяющее значимость поля по сравнению с остальными индексируемыми полями. + + + + Default language: + Язык по умолчанию: + + + + Language override: + Переопределение языка: + + + + Text weights + Веса полей + + + + + Invalid json + Некорректный JSON + + + + + Please check json text. + + Проверьте, пожалуйста, JSON. + + + + Robomongo::ExplorerCollectionDirIndexesTreeItem + + + + Add Index... + Добавить индекс... + + + + Drop Index... + Удалить индекс... + + + + Rebuild Indexes... + Перестроить индексы... + + + + View Indexes + Просмотр индексов + + + + Refresh + Обновить + + + + Indexes + Индексы + + + + A unique index causes MongoDB to reject all documents that contain a duplicate value for the indexed field. + Уникальный индекс приведет к тому, что MongoDB будет отклонять все документы с повторяющимися значениями проиндексированного поля. + + + + Sparse indexes only contain entries for documents that have the indexed field. + Частичный индекс содержит только документы, в которых имеется индексируемое поле. + + + + Robomongo::ExplorerCollectionIndexesTreeItem + + + Drop Index... + Удалить индекс... + + + + Edit Index... + Изменить индекс... + + + + Drop + Удалить + + + + Index + Индекс + + + + Robomongo::ExplorerCollectionTreeItem + + + Insert Document... + Вставить документ... + + + + Update Documents... + Изменить документы... + + + + Remove Documents... + Удалить документы... + + + + Remove All Documents... + Удалить все документы... + + + + Statistics + Статистика + + + + Storage Size + Размер на диске + + + + Total Index Size + Общий размер индекса + + + + Total Size + Общий размер + + + + Shard Version + Версия шарда + + + + Shard Distribution + Распределение шарда + + + + Drop Collection... + Удалить коллекцию... + + + + Rename Collection... + Переименовать коллекцию... + + + + Duplicate Collection... + Дублировать коллекцию... + + + + Copy Collection to Database... + Копировать коллекцию в базу данных... + + + + View Documents + Просмотреть документы + + + + Insert Document + Вставить документ + + + + Remove All Documents + Удалить все документы + + + + Remove all documents from <b>%1</b> collection? + Удалить все документы из коллекции <b>%1</b>? + + + + update only one document + изменить только один документ + + + + insert a new document, if no existing document match the query + вставить новый документ, если ни один из существующих не удовлетворяет условиям запроса + + + + Drop + Удалить + + + + collection + коллекцию + + + + Duplicate Collection + Дублировать коллекцию + + + + &Duplicate + &Дублировать + + + + + New Collection Name: + Имя новой коллекции: + + + + Rename Collection + Переименовать коллекцию + + + + &Rename + Пере&именовать + + + + Robomongo::ExplorerDatabaseCategoryTreeItem + + + Create Collection... + Создать коллекцию... + + + + Collections Statistics + Статистика коллекций + + + + + + Refresh + Обновить + + + + View Users + Просмотреть пользователей + + + + Add User... + Добавить пользователя... + + + + View Functions + Просмотреть функции + + + + Add Function... + Добавить функцию... + + + + Create Collection + Создать коллекцию + + + + &Create + &Создать + + + + Collection Name: + Имя коллекции: + + + + Create Function + Создать функцию + + + + write your code here + напишите здесь ваш код + + + + Robomongo::ExplorerDatabaseTreeItem + + + Open Shell + Открыть консоль + + + + Database Statistics + Статистика базы данных + + + Drop Database.. + Удалить базу данных... + + + + Drop Database... + Удалить базу данных... + + + + Repair Database... + Исправить базу данных... + + + + Refresh + Обновить + + + + + + Collections + Коллекции + + + + + + Functions + Функции + + + + + + Users + Пользователи + + + + System + Система + + + + Drop <b>%1</b> database? + Удалить базу данных <b>%1</b>? + + + + Drop Database + Удалить базу данных + + + + Robomongo::ExplorerFunctionTreeItem + + + Remove Function + Удалить функцию + + + + + Edit Function + Изменить функцию + + + + Drop + Удалить + + + + Function + Функцию + + + + Robomongo::ExplorerServerTreeItem + + + Open Shell + Открыть консоль + + + + Refresh + Обновить + + + + Create Database + Создать базу данных + + + + Server Status + Состояние сервера + + + + MongoDB Version + Версия MongoDB + + + + Host Info + Информация о хосте + + + + Show Log + Показать журнал + + + + + Disconnect + + + + + System + Система + + + + &Create + &Создать + + + + Database Name: + Имя базы данных: + + + + Robomongo::ExplorerUserTreeItem + + + Drop User + Удалить пользователя + + + + + Edit User + Изменить пользователя + + + + Drop + Удалить + + + + User + Пользователя + + + + New Password: + Новый пароль: + + + + Robomongo::FindFrame + + + Next + Далее + + + + Previous + Назад + + + + Match case + Учитывать регистр + + + + Search + Поиск + + + + The specified text was not found. + Указанный текст не найден. + + + + Robomongo::FunctionTextEditor + + + Name: + Имя: + + + + Code: + Код: + + + + Robomongo::LogWidget + + + Clear All + Очистить + + + + Robomongo::MainWindow + + + &Open... + &Открыть... + + + + Load script from the file to the currently opened shell + Загрузить скрипт из файла в текущую консоль + + + + &Save + &Сохранить + + + + Save &As... + Сохранить &как... + + + + &Exit + &Выход + + + + + &Connect... + &Подключить... + + + + Connect + Подключить + + + + &Rotate + Пове&рнуть + + + + Toggle orientation of results view <b>(F10)</b> + Сменить ориентацию окна результатов <b>(F10)</b> + + + + &Text Mode + &Текстовый режим + + + + Show current tab in text mode, and make this mode default for all subsequent queries <b>(F4)</b> + Текстовый режим для этой и дочерних вкладок <b>(F4)</b> + + + + &Tree Mode + Режим &Дерева + + + + Show current tab in tree mode, and make this mode default for all subsequent queries <b>(F3)</b> + Режим Дерева для этой и дочерних вкладок <b>(F3)</b> + + + + T&able Mode + Та&бличный режим + + + + Show current tab in table mode, and make this mode default for all subsequent queries <b>(F3)</b> + Табличный режим для этой и дочерних вкладок <b>(F3)</b> + + + + &Custom Mode + &Пользовательский режим + + + + Show current tab in custom mode if possible, and make this mode default for all subsequent queries <b>(F2)</b> + Пользовательский режим для этой и дочерних вкладок <b>(F2)</b> + + + + Execute query for current tab. If you have some selection in query text - only selection will be executed <b>(F5 </b> or <b>%1 + Enter)</b> + Выполнить запрос в этой вкладке. Если выделена часть текста &mdash; будет выполнена только она <b>(F5 </b> или <b>%1 + Enter)</b> + + + + Show Line Numbers By Default + Показывать номера строк по умолчанию + + + + Disable Connection Shortcuts + Отключить горячие клавиши подключений + + + + Stop execution of currently running script. <b>(F6)</b> + Остановить выполнение скрипта <b>(F6)</b> + + + + &Full Screen + &На весь экран + + + + Refresh + Обновить + + + + File + Файл + + + + View + Вид + + + + Options + Опции + + + + Default View Mode + Режим по умолчанию + + + + Display Dates In... + Отображать даты в... + + + + Auto Expand First Document + Разворачивать первый документ + + + + Do not decode (show as is) + Не декодировать (показывать как есть) + + + + Use Java Encoding + Кодировка Java + + + + Use .NET Encoding + Кодировка .NET + + + + Use Python Encoding + Кодировка Python + + + + Legacy UUID Encoding + Традиционная кодировка UUID + + + + Load .mongorc.js + Выполнять .mongorc.js + + + + Ctrl + Ctrl + + + + Save script of the currently opened shell to the file <b>(%1 + S)</b> + Сохранить скрипт из текущей консоли в файл <b>(%1 + S)</b> + + + + + Connect to local or remote MongoDB instance <b>(%1 + O)</b> + Подключиться к локальному или удаленному серверу MongoDB <b>(%1 + O)</b> + + + + Preferences + Предпочтения + + + + &About Robomongo... + &О Robomongo... + + + + Window + Окно + + + + &Minimize + Свернут&ь + + + + Select Next Tab + Следующая вкладка + + + + Select Previous Tab + Предыдущая вкладка + + + + Help + Помощь + + + + Toolbar + Панель инструментов + + + + Open/Save ToolBar + Панель загрузки/сохранения + + + + Exec Toolbar + Панель выполнения + + + + Theme + Тема + + + + Language + Язык + + + + System locale (if available) + Language based on system locale + Язык системы (если доступен) + + + + + Logs + Журнал + + + + &Manage Connections... + &Настройки соединений... + + + + Connect to MongoDB + Подключиться к MongoDB + + + + + Cannot connect to MongoDB (%1) + Не удаётся подкючиться к MongoDB (%1) + + + + + + Error + Ошибка + + + + Refresh not working yet... : <br/> <b>Ctrl+D</b> : push Button + Обновление пока не работает... : <br/> <b>Ctrl+D</b> : нажать кнопку + + + + Cannot connect to MongoDB (%1), +error: %2 + Не удаётся подкючиться к MongoDB (%1), ошибка: %2 + + + + Database Explorer + Проводник базы данных + + + + &Explorer + П&роводник + + + + Press to show/hide Database Explorer panel. + Нажмите, чтобы показать/спрятать панель Проводника Базы данных. + + + + &Logs + &Журнал + + + + Robomongo::MongoWorker + + + Unable to authorize + Не удаётся авторизоваться + + + + Unable to connect to MongoDB + Не удаётся подключиться к MongoDB + + + + Unable to load database names. + Не удаётся загрузить имена баз данных. + + + + Unable to load list of collections. + Не удаётся загрузить список коллекций. + + + + Unable to load list of users. + Не удаётся загрузить список пользователей. + + + + Unable to load list of functions. + Не удаётся загрузить список функций. + + + + Unable to insert document. + Не удаётся вставить документ. + + + + Unable to remove documents. + Не удаётся удалить документы. + + + + + Unable to complete query. + Не удаётся выполнить запрос. + + + + Unable to autocomplete query. + Не удаётся автоматически завершить запрос. + + + + Unable to create database. + Не удаётся создать базу данных. + + + + Unable to drop database. + Не удаётся удалить базу данных. + + + + Unable to create collection. + Не удаётся создать коллекцию. + + + + Unable to drop collection. + Не удаётся удалить коллекцию. + + + + Unable to rename collection. + Не удаётся переименовать коллекцию. + + + + Unable to duplicate collection. + Не удаётся дублировать коллекцию. + + + + Unable to copy collection. + Не удаётся скопировать коллекцию. + + + + Unable to create/ovewrite user. + Не удаётся создать/перезаписать пользователя. + + + + Unable to drop user. + Не удаётся удалить пользователя. + + + + Unable to create/ovewrite function. + Не удаётся создать/перезаписать функцию. + + + + Unable to drop function. + Не удаётся удалить функцию. + + + + Robomongo::Notifier + + + Delete Document... + Удалить документ... + + + + Delete Documents... + Удалить документы... + + + + Edit Document... + Редактировать документ... + + + + View Document... + Просмотреть документ... + + + + Insert Document... + Вставить документ... + + + + Copy Value + Копировать значение + + + + Copy JSON + Копировать JSON + + + + Cannot delete + Не удаётся удалить + + + + Selected document doesn't have _id field. +Maybe this is a system document that should be managed in a special way? + Выбранный документ не содержит поля _id. Возможно, это системный документ, редактировать который нужно каким-то особым образом? + + + + + Delete + Удалить + + + + Document + Документ + + + + %1 %2 with id:<br><b>%3</b>? + %1 %2 с id:<br><b>%3</b>? + + + + Do you want to delete %n selected documents? + + Вы хотите удалить %n выбранный документ? + Вы хотите удалить %n выбранных документа? + Вы хотите удалить %n выбранных документов? + + + + + Edit Document + Редактор документа + + + + View Document + Просмотр документа + + + + Insert Document + Вставить документ + + + + Robomongo::OutputItemContentWidget + + + %1 sec. + %1 сек. + + + + Loading... + Загрузка... + + + + Robomongo::OutputItemHeaderWidget + + + Maximize or restore back this output result. You also can double-click on result's header. + Развернуть или свернуть эту панель результата. То же самое делает двойной щелчок на заголовке панели. + + + + View results in text mode + Смотреть результат в текстовом режиме + + + + View results in tree mode + Смотреть результат в режиме дерева + + + + View results in table mode + Смотреть результат в табличном режиме + + + + View results in custom UI + Смотреть результат в пользовательском режиме + + + + Robomongo::PagingWidget + + + Skip + Сколько документов в начале выборки пропустить + + + + Batch Size (number of documents shown at once) + Сколько документов показать на одной странице + + + + Robomongo::QueryWidget + + + New Shell + Новая консоль + + + + Script executed successfully, but there are no results to show. + Скрипт выполнен успешно, но результатов для отображения нет. + + + Script executed successfully, but there is no results to show. + Скрипт выполнен успешно, но результатов для отображения нет. + + + + Robomongo::ScriptInfo + + + JavaScript (*.js);; All Files (*.*) + JavaScript (*.js);; Все файлы (*.*) + + + + Save As + Сохранить как + + + + Robomongo::ScriptWidget + + + loading... + загрузка... + + + + Robomongo::SettingsManager + + + + __LANGUAGE_NAME__ + Native language name: "English" for English, "Русский" for Russian etc. + Русский + + + + Robomongo::SshTunelTab + + + Use SSH tunnel + Использовать SSH-туннель + + + + + Password + Пароль + + + + + Private Key + Секретный ключ + + + + User Password: + Пароль пользователя: + + + + Private key: + Закрытый ключ: + + + + Passphrase: + Парольная фраза: + + + + SSH Address: + Адрес SSH: + + + + SSH User Name: + Пользователь SSH: + + + + SSH Auth Method: + Способ аутентификации SSH: + + + + Select private key file + Выберите файл секретного ключа + + + + Private key files (*.*) + Файлы закрытых ключей (*.*) + + + + Robomongo::WorkAreaTabBar + + + &New Shell + &Новая консоль + + + + &Reload + Перезаг&рузить + + + + &Duplicate + &Дублировать + + + + &Pin Shell + За&крепить консоль + + + + &Close Shell + &Закрыть консоль + + + + Close &Other Shells + Закрыть &остальные консоли + + + + Close Shells to the R&ight + Закрыть консоли с&права + + + + Robomongo::WorkAreaTabWidget + + + Loading... + Загрузка... + + + + loadFromFileText + + + Error + Ошибка + + + + can't read from %1: +%2. + Не удаётся прочитать %1: +%2. + + + + parseDocument + + + Array [%1] + Массив [%1] + + + + { %n fields } + + { %n поле} + { %n поля} + { %n полей } + + + + + saveToFileText + + + Error + Ошибка + + + + can't save to %1: +%2. + Не удаётся сохранить %1: +%2. + + +