解决翻译问题。

This commit is contained in:
iaom 2022-05-23 15:48:16 +08:00
parent 6d060e2c0b
commit 6009d862ca
7 changed files with 47 additions and 43 deletions

View File

@ -25,26 +25,26 @@ UkuiSearchGui::UkuiSearchGui(int &argc, char *argv[], const QString &application
//load translations. //load translations.
QTranslator translator; QTranslator *translator = new QTranslator(this);
try { try {
if(! translator.load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw - 1; if(! translator->load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw - 1;
this->installTranslator(&translator); this->installTranslator(translator);
} catch(...) { } catch(...) {
qDebug() << "Load translations file" << QLocale() << "failed!"; qDebug() << "Load translations file" << QLocale() << "failed!";
} }
QTranslator qt_translator; QTranslator *qt_translator = new QTranslator(this);
try { try {
if(! qt_translator.load(":/res/qt-translations/qt_zh_CN.qm")) throw - 1; if(! qt_translator->load(":/res/qt-translations/qt_zh_CN.qm")) throw - 1;
this->installTranslator(&qt_translator); this->installTranslator(qt_translator);
} catch(...) { } catch(...) {
qDebug() << "Load translations file" << QLocale() << "failed!"; qDebug() << "Load translations file" << QLocale() << "failed!";
} }
QTranslator lib_translator; QTranslator *lib_translator = new QTranslator(this);
try { try {
if(! lib_translator.load("/usr/share/ukui-search/translations/libukui-search_" + QLocale::system().name())) throw - 1; if(! lib_translator->load("/usr/share/ukui-search/translations/libukui-search_" + QLocale::system().name())) throw - 1;
this->installTranslator(&lib_translator); this->installTranslator(lib_translator);
} catch(...) { } catch(...) {
qDebug() << "Load translations file" << QLocale() << "failed!"; qDebug() << "Load translations file" << QLocale() << "failed!";
} }

View File

@ -302,7 +302,7 @@ QWidget *DirSearchPlugin::detailPage(const ResultInfo &ri)
} else { } else {
m_nameLabel->setToolTip(""); m_nameLabel->setToolTip("");
} }
m_pluginLabel->setText(tr("directory")); m_pluginLabel->setText(tr("Directory"));
m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width())); m_pathLabel2->setText(m_pathLabel2->fontMetrics().elidedText(m_currentActionKey, Qt::ElideRight, m_pathLabel2->width()));
m_pathLabel2->setToolTip(m_currentActionKey); m_pathLabel2->setToolTip(m_currentActionKey);

View File

@ -5,123 +5,123 @@
<name>Search</name> <name>Search</name>
<message> <message>
<location filename="../search.cpp" line="13"/> <location filename="../search.cpp" line="13"/>
<location filename="../search.cpp" line="130"/> <location filename="../search.cpp" line="121"/>
<source>Search</source> <source>Search</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="154"/> <location filename="../search.cpp" line="145"/>
<source>Create index</source> <source>Create index</source>
<translation></translation> <translation></translation>
<extra-contents_path>/Search/Create index</extra-contents_path> <extra-contents_path>/Search/Create index</extra-contents_path>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="155"/> <location filename="../search.cpp" line="146"/>
<source>Creating index can help you getting results quickly.</source> <source>Creating index can help you getting results quickly.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="174"/> <location filename="../search.cpp" line="165"/>
<source>Default web searching engine</source> <source>Default web searching engine</source>
<translation></translation> <translation></translation>
<extra-contents_path>/Search/Default web searching engine</extra-contents_path> <extra-contents_path>/Search/Default web searching engine</extra-contents_path>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="178"/> <location filename="../search.cpp" line="169"/>
<source>baidu</source> <source>baidu</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="179"/> <location filename="../search.cpp" line="170"/>
<source>sougou</source> <source>sougou</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="180"/> <location filename="../search.cpp" line="171"/>
<source>360</source> <source>360</source>
<translation>360</translation> <translation>360</translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="188"/> <location filename="../search.cpp" line="179"/>
<source>Block Folders</source> <source>Block Folders</source>
<translation></translation> <translation></translation>
<extra-contents_path>/Search/Block Folders</extra-contents_path> <extra-contents_path>/Search/Block Folders</extra-contents_path>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="193"/> <location filename="../search.cpp" line="184"/>
<source>Following folders will not be searched. You can set it by adding and removing folders.</source> <source>Following folders will not be searched. You can set it by adding and removing folders.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="233"/> <location filename="../search.cpp" line="224"/>
<source>Choose folder</source> <source>Choose folder</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="346"/> <location filename="../search.cpp" line="337"/>
<source>delete</source> <source>delete</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="401"/> <location filename="../search.cpp" line="392"/>
<source>Directories</source> <source>Directories</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="402"/> <location filename="../search.cpp" line="393"/>
<source>select blocked folder</source> <source>select blocked folder</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="403"/> <location filename="../search.cpp" line="394"/>
<source>Select</source> <source>Select</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="404"/> <location filename="../search.cpp" line="395"/>
<source>Position: </source> <source>Position: </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="405"/> <location filename="../search.cpp" line="396"/>
<source>FileName: </source> <source>FileName: </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="406"/> <location filename="../search.cpp" line="397"/>
<source>FileType: </source> <source>FileType: </source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="407"/> <location filename="../search.cpp" line="398"/>
<source>Cancel</source> <source>Cancel</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="423"/> <location filename="../search.cpp" line="414"/>
<location filename="../search.cpp" line="427"/> <location filename="../search.cpp" line="418"/>
<location filename="../search.cpp" line="431"/> <location filename="../search.cpp" line="422"/>
<location filename="../search.cpp" line="435"/> <location filename="../search.cpp" line="426"/>
<source>Warning</source> <source>Warning</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="423"/> <location filename="../search.cpp" line="414"/>
<source>Add blocked folder failed, choosen path is empty!</source> <source>Add blocked folder failed, choosen path is empty!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="427"/> <location filename="../search.cpp" line="418"/>
<source>Add blocked folder failed, it is not in home path!</source> <source>Add blocked folder failed, it is not in home path!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="431"/> <location filename="../search.cpp" line="422"/>
<source>Add blocked folder failed, its parent dir is exist!</source> <source>Add blocked folder failed, its parent dir is exist!</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../search.cpp" line="435"/> <location filename="../search.cpp" line="426"/>
<source>Add blocked folder failed, it has been already blocked!</source> <source>Add blocked folder failed, it has been already blocked!</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -82,15 +82,19 @@
<source>Dir Search</source> <source>Dir Search</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<location filename="../../libsearch/index/file-search-plugin.cpp" line="302"/>
<source>Directory</source>
<translation></translation>
</message>
<message> <message>
<location filename="../../libsearch/index/file-search-plugin.cpp" line="237"/> <location filename="../../libsearch/index/file-search-plugin.cpp" line="237"/>
<source>Dir search.</source> <source>Dir search.</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/index/file-search-plugin.cpp" line="302"/>
<source>directory</source> <source>directory</source>
<translation></translation> <translation type="vanished"></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/index/file-search-plugin.cpp" line="339"/> <location filename="../../libsearch/index/file-search-plugin.cpp" line="339"/>
@ -313,12 +317,12 @@
<context> <context>
<name>UkuiSearch::SearchManager</name> <name>UkuiSearch::SearchManager</name>
<message> <message>
<location filename="../../libsearch/index/search-manager.cpp" line="67"/> <location filename="../../libsearch/index/search-manager.cpp" line="68"/>
<source>Path:</source> <source>Path:</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../libsearch/index/search-manager.cpp" line="68"/> <location filename="../../libsearch/index/search-manager.cpp" line="69"/>
<source>Modified time:</source> <source>Modified time:</source>
<translation></translation> <translation></translation>
</message> </message>

View File

@ -58,7 +58,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../frontend/mainwindow.cpp" line="75"/> <location filename="../../frontend/mainwindow.cpp" line="76"/>
<source>Global Search</source> <source>Global Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -358,7 +358,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../frontend/mainwindow.cpp" line="75"/> <location filename="../../frontend/mainwindow.cpp" line="76"/>
<source>Global Search</source> <source>Global Search</source>
<translation type="unfinished">Genel Arama</translation> <translation type="unfinished">Genel Arama</translation>
</message> </message>

View File

@ -120,7 +120,7 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../../frontend/mainwindow.cpp" line="75"/> <location filename="../../frontend/mainwindow.cpp" line="76"/>
<source>Global Search</source> <source>Global Search</source>
<translation></translation> <translation></translation>
</message> </message>