Misc work in translation

Update translations
Fix the translation in t55xxtab
(QTranslator must be created before wigets)
Reduce unnecessary translations
This commit is contained in:
wh201906 2023-02-26 12:33:15 +08:00
parent 92d704bc96
commit b788d6a15f
No known key found for this signature in database
11 changed files with 697 additions and 833 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -128,7 +128,7 @@ bool Util::chooseLanguage(QSettings* guiSettings, QMainWindow* window)
return false; return false;
if(langMap[selectedText] == "(ext)") if(langMap[selectedText] == "(ext)")
{ {
QString extPath = QFileDialog::getOpenFileName(nullptr, tr("Select the translation file:")); QString extPath = QFileDialog::getOpenFileName(window, tr("Select the translation file:"));
if(extPath.isEmpty()) if(extPath.isEmpty())
return false; return false;

View File

@ -59,7 +59,7 @@ public:
static ClientType getClientType(); static ClientType getClientType();
static int rawTabIndex; static int rawTabIndex;
static QDockWidget* rawDockPtr; static QDockWidget* rawDockPtr;
static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window); static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window = nullptr);
public slots: public slots:
void processOutput(const QString& output); void processOutput(const QString& output);
static void setClientType(Util::ClientType clientType); static void setClientType(Util::ClientType clientType);

View File

@ -23,7 +23,6 @@ int main(int argc, char *argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w;
QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat); QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat);
settings->setIniCodec("UTF-8"); settings->setIniCodec("UTF-8");
@ -36,7 +35,7 @@ int main(int argc, char *argv[])
settings->endGroup(); settings->endGroup();
if(languageName == "") if(languageName == "")
{ {
if(Util::chooseLanguage(settings, &w)) if(Util::chooseLanguage(settings))
{ {
settings->beginGroup("language"); settings->beginGroup("language");
languageName = settings->value("name").toString(); languageName = settings->value("name").toString();
@ -53,11 +52,13 @@ int main(int argc, char *argv[])
} }
else else
languageFile = ":/i18n/" + languageName + ".qm"; languageFile = ":/i18n/" + languageName + ".qm";
QTranslator* translator = new QTranslator(&w);
// Note that the translator must be created before the application's widgets.
QTranslator* translator = new QTranslator();
if(translator->load(languageFile)) if(translator->load(languageFile))
a.installTranslator(translator); a.installTranslator(translator);
else else
QMessageBox::information(&w, "Error", "Can't load " + languageFile + " as translation file."); QMessageBox::information(nullptr, "Error", "Can't load " + languageFile + " as translation file.");
QFile* themeFile = new QFile(); QFile* themeFile = new QFile();
QTextStream* themeStream = new QTextStream(); QTextStream* themeStream = new QTextStream();
@ -87,6 +88,7 @@ int main(int argc, char *argv[])
delete settings; delete settings;
settings = nullptr; settings = nullptr;
MainWindow w;
w.initUI(); w.initUI();
w.show(); w.show();
return a.exec(); return a.exec();

View File

@ -1286,7 +1286,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>125k</string> <string notr="true">125k</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@ -1302,7 +1302,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>134k</string> <string notr="true">134k</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -3192,7 +3192,7 @@ or the communication between a tag and a reader.</string>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/wh201906/Proxmark3GUI/releases/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/wh201906/Proxmark3GUI/releases/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/wh201906/Proxmark3GUI/releases/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/wh201906/Proxmark3GUI/releases/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
@ -3222,7 +3222,7 @@ or the communication between a tag and a reader.</string>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/wh201906/Proxmark3GUI/issues/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/wh201906/Proxmark3GUI/issues/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://github.com/wh201906/Proxmark3GUI/issues/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/wh201906/Proxmark3GUI/issues/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>

View File

@ -35,7 +35,7 @@
<item> <item>
<widget class="QCheckBox" name="uBox"> <widget class="QCheckBox" name="uBox">
<property name="text"> <property name="text">
<string>u</string> <string notr="true">u</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -102,7 +102,7 @@
<item> <item>
<widget class="QCheckBox" name="atqaBox"> <widget class="QCheckBox" name="atqaBox">
<property name="text"> <property name="text">
<string>--atqa</string> <string notr="true">--atqa</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -169,7 +169,7 @@
<item> <item>
<widget class="QCheckBox" name="sakBox"> <widget class="QCheckBox" name="sakBox">
<property name="text"> <property name="text">
<string>--sak</string> <string notr="true">--sak</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -236,7 +236,7 @@
<item> <item>
<widget class="QCheckBox" name="nBox"> <widget class="QCheckBox" name="nBox">
<property name="text"> <property name="text">
<string>n</string> <string notr="true">n</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -303,7 +303,7 @@
<item> <item>
<widget class="QCheckBox" name="iBox"> <widget class="QCheckBox" name="iBox">
<property name="text"> <property name="text">
<string>i</string> <string notr="true">i</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -354,7 +354,7 @@
<item> <item>
<widget class="QCheckBox" name="xBox"> <widget class="QCheckBox" name="xBox">
<property name="text"> <property name="text">
<string>x</string> <string notr="true">x</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -405,7 +405,7 @@
<item> <item>
<widget class="QCheckBox" name="eBox"> <widget class="QCheckBox" name="eBox">
<property name="text"> <property name="text">
<string>e</string> <string notr="true">e</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -456,7 +456,7 @@
<item> <item>
<widget class="QCheckBox" name="fBox"> <widget class="QCheckBox" name="fBox">
<property name="text"> <property name="text">
<string>f</string> <string notr="true">f</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -523,7 +523,7 @@
<item> <item>
<widget class="QCheckBox" name="rBox"> <widget class="QCheckBox" name="rBox">
<property name="text"> <property name="text">
<string>r</string> <string notr="true">r</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -574,7 +574,7 @@
<item> <item>
<widget class="QCheckBox" name="vBox"> <widget class="QCheckBox" name="vBox">
<property name="text"> <property name="text">
<string>-v</string> <string notr="true">-v</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -25,7 +25,7 @@
<item> <item>
<widget class="QRadioButton" name="size4Button"> <widget class="QRadioButton" name="size4Button">
<property name="text"> <property name="text">
<string>4</string> <string notr="true">4</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@ -35,7 +35,7 @@
<item> <item>
<widget class="QRadioButton" name="size16Button"> <widget class="QRadioButton" name="size16Button">
<property name="text"> <property name="text">
<string>16</string> <string notr="true">16</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -131,7 +131,7 @@
<item> <item>
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Cx0</string> <string notr="true">Cx0</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -152,7 +152,7 @@
<item> <item>
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Cx1</string> <string notr="true">Cx1</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -173,7 +173,7 @@
<item> <item>
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>Cx2</string> <string notr="true">Cx2</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -194,7 +194,7 @@
<item> <item>
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="text"> <property name="text">
<string>Cx3</string> <string notr="true">Cx3</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -214,84 +214,84 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="C10Label"> <widget class="QLabel" name="C10Label">
<property name="text"> <property name="text">
<string>C10</string> <string notr="true">C10</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="C11Label"> <widget class="QLabel" name="C11Label">
<property name="text"> <property name="text">
<string>C11</string> <string notr="true">C11</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QLabel" name="C12Label"> <widget class="QLabel" name="C12Label">
<property name="text"> <property name="text">
<string>C12</string> <string notr="true">C12</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QLabel" name="C13Label"> <widget class="QLabel" name="C13Label">
<property name="text"> <property name="text">
<string>C13</string> <string notr="true">C13</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="C20Label"> <widget class="QLabel" name="C20Label">
<property name="text"> <property name="text">
<string>C20</string> <string notr="true">C20</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QLabel" name="C21Label"> <widget class="QLabel" name="C21Label">
<property name="text"> <property name="text">
<string>C21</string> <string notr="true">C21</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QLabel" name="C22Label"> <widget class="QLabel" name="C22Label">
<property name="text"> <property name="text">
<string>C22</string> <string notr="true">C22</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3"> <item row="1" column="3">
<widget class="QLabel" name="C23Label"> <widget class="QLabel" name="C23Label">
<property name="text"> <property name="text">
<string>C23</string> <string notr="true">C23</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="C30Label"> <widget class="QLabel" name="C30Label">
<property name="text"> <property name="text">
<string>C30</string> <string notr="true">C30</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLabel" name="C31Label"> <widget class="QLabel" name="C31Label">
<property name="text"> <property name="text">
<string>C31</string> <string notr="true">C31</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2"> <item row="2" column="2">
<widget class="QLabel" name="C32Label"> <widget class="QLabel" name="C32Label">
<property name="text"> <property name="text">
<string>C32</string> <string notr="true">C32</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="2" column="3">
<widget class="QLabel" name="C33Label"> <widget class="QLabel" name="C33Label">
<property name="text"> <property name="text">
<string>C33</string> <string notr="true">C33</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -19,7 +19,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="uIDLabel"> <widget class="QLabel" name="uIDLabel">
<property name="text"> <property name="text">
<string>UID:</string> <string notr="true">UID:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -29,7 +29,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="ATQALabel"> <widget class="QLabel" name="ATQALabel">
<property name="text"> <property name="text">
<string>ATQA:</string> <string notr="true">ATQA:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -39,7 +39,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="SAKLabel"> <widget class="QLabel" name="SAKLabel">
<property name="text"> <property name="text">
<string>SAK:</string> <string notr="true">SAK:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -29,14 +29,14 @@
<item> <item>
<widget class="QRadioButton" name="Clone_T5555Button"> <widget class="QRadioButton" name="Clone_T5555Button">
<property name="text"> <property name="text">
<string>T5555</string> <string notr="true">T5555</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="Clone_T55x7Button"> <widget class="QRadioButton" name="Clone_T55x7Button">
<property name="text"> <property name="text">
<string>T55x7</string> <string notr="true">T55x7</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
@ -61,7 +61,7 @@
<item> <item>
<widget class="QGroupBox" name="Clone_EM410xGroupBox"> <widget class="QGroupBox" name="Clone_EM410xGroupBox">
<property name="title"> <property name="title">
<string>EM410x</string> <string notr="true">EM410x</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>