Skip to content

Commit

Permalink
Misc work in translation
Browse files Browse the repository at this point in the history
Update translations
Fix the translation in t55xxtab
(QTranslator must be created before wigets)
Reduce unnecessary translations
  • Loading branch information
wh201906 committed Feb 26, 2023
1 parent 92d704b commit b788d6a
Show file tree
Hide file tree
Showing 11 changed files with 695 additions and 831 deletions.
711 changes: 323 additions & 388 deletions i18n/en_US.ts

Large diffs are not rendered by default.

Binary file modified i18n/zh_CN.qm
Binary file not shown.
725 changes: 326 additions & 399 deletions i18n/zh_CN.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/common/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ bool Util::chooseLanguage(QSettings* guiSettings, QMainWindow* window)
return false;
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())
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/common/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Util : public QObject
static ClientType getClientType();
static int rawTabIndex;
static QDockWidget* rawDockPtr;
static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window);
static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window = nullptr);
public slots:
void processOutput(const QString& output);
static void setClientType(Util::ClientType clientType);
Expand Down
10 changes: 6 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ int main(int argc, char *argv[])
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QApplication a(argc, argv);
MainWindow w;

QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat);
settings->setIniCodec("UTF-8");
Expand All @@ -36,7 +35,7 @@ int main(int argc, char *argv[])
settings->endGroup();
if(languageName == "")
{
if(Util::chooseLanguage(settings, &w))
if(Util::chooseLanguage(settings))
{
settings->beginGroup("language");
languageName = settings->value("name").toString();
Expand All @@ -53,11 +52,13 @@ int main(int argc, char *argv[])
}
else
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))
a.installTranslator(translator);
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();
QTextStream* themeStream = new QTextStream();
Expand Down Expand Up @@ -87,6 +88,7 @@ int main(int argc, char *argv[])
delete settings;
settings = nullptr;

MainWindow w;
w.initUI();
w.show();
return a.exec();
Expand Down
8 changes: 4 additions & 4 deletions src/ui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@
</sizepolicy>
</property>
<property name="text">
<string>125k</string>
<string notr="true">125k</string>
</property>
<property name="checked">
<bool>true</bool>
Expand All @@ -1302,7 +1302,7 @@
</sizepolicy>
</property>
<property name="text">
<string>134k</string>
<string notr="true">134k</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -3192,7 +3192,7 @@ or the communication between a tag and a reader.</string>
</sizepolicy>
</property>
<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 name="openExternalLinks">
<bool>true</bool>
Expand Down Expand Up @@ -3222,7 +3222,7 @@ or the communication between a tag and a reader.</string>
</sizepolicy>
</property>
<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 name="openExternalLinks">
<bool>true</bool>
Expand Down
20 changes: 10 additions & 10 deletions src/ui/mf_sim_simdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<item>
<widget class="QCheckBox" name="uBox">
<property name="text">
<string>u</string>
<string notr="true">u</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -102,7 +102,7 @@
<item>
<widget class="QCheckBox" name="atqaBox">
<property name="text">
<string>--atqa</string>
<string notr="true">--atqa</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -169,7 +169,7 @@
<item>
<widget class="QCheckBox" name="sakBox">
<property name="text">
<string>--sak</string>
<string notr="true">--sak</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -236,7 +236,7 @@
<item>
<widget class="QCheckBox" name="nBox">
<property name="text">
<string>n</string>
<string notr="true">n</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -303,7 +303,7 @@
<item>
<widget class="QCheckBox" name="iBox">
<property name="text">
<string>i</string>
<string notr="true">i</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -354,7 +354,7 @@
<item>
<widget class="QCheckBox" name="xBox">
<property name="text">
<string>x</string>
<string notr="true">x</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -405,7 +405,7 @@
<item>
<widget class="QCheckBox" name="eBox">
<property name="text">
<string>e</string>
<string notr="true">e</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -456,7 +456,7 @@
<item>
<widget class="QCheckBox" name="fBox">
<property name="text">
<string>f</string>
<string notr="true">f</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -523,7 +523,7 @@
<item>
<widget class="QCheckBox" name="rBox">
<property name="text">
<string>r</string>
<string notr="true">r</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -574,7 +574,7 @@
<item>
<widget class="QCheckBox" name="vBox">
<property name="text">
<string>-v</string>
<string notr="true">-v</string>
</property>
</widget>
</item>
Expand Down
36 changes: 18 additions & 18 deletions src/ui/mf_trailerdecoderdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<item>
<widget class="QRadioButton" name="size4Button">
<property name="text">
<string>4</string>
<string notr="true">4</string>
</property>
<property name="checked">
<bool>true</bool>
Expand All @@ -35,7 +35,7 @@
<item>
<widget class="QRadioButton" name="size16Button">
<property name="text">
<string>16</string>
<string notr="true">16</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -131,7 +131,7 @@
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Cx0</string>
<string notr="true">Cx0</string>
</property>
</widget>
</item>
Expand All @@ -152,7 +152,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Cx1</string>
<string notr="true">Cx1</string>
</property>
</widget>
</item>
Expand All @@ -173,7 +173,7 @@
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Cx2</string>
<string notr="true">Cx2</string>
</property>
</widget>
</item>
Expand All @@ -194,7 +194,7 @@
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Cx3</string>
<string notr="true">Cx3</string>
</property>
</widget>
</item>
Expand All @@ -214,84 +214,84 @@
<item row="0" column="0">
<widget class="QLabel" name="C10Label">
<property name="text">
<string>C10</string>
<string notr="true">C10</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="C11Label">
<property name="text">
<string>C11</string>
<string notr="true">C11</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="C12Label">
<property name="text">
<string>C12</string>
<string notr="true">C12</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="C13Label">
<property name="text">
<string>C13</string>
<string notr="true">C13</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="C20Label">
<property name="text">
<string>C20</string>
<string notr="true">C20</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="C21Label">
<property name="text">
<string>C21</string>
<string notr="true">C21</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="C22Label">
<property name="text">
<string>C22</string>
<string notr="true">C22</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="C23Label">
<property name="text">
<string>C23</string>
<string notr="true">C23</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="C30Label">
<property name="text">
<string>C30</string>
<string notr="true">C30</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="C31Label">
<property name="text">
<string>C31</string>
<string notr="true">C31</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="C32Label">
<property name="text">
<string>C32</string>
<string notr="true">C32</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="C33Label">
<property name="text">
<string>C33</string>
<string notr="true">C33</string>
</property>
</widget>
</item>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/mf_uid_parameterdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<item row="0" column="0">
<widget class="QLabel" name="uIDLabel">
<property name="text">
<string>UID:</string>
<string notr="true">UID:</string>
</property>
</widget>
</item>
Expand All @@ -29,7 +29,7 @@
<item row="1" column="0">
<widget class="QLabel" name="ATQALabel">
<property name="text">
<string>ATQA:</string>
<string notr="true">ATQA:</string>
</property>
</widget>
</item>
Expand All @@ -39,7 +39,7 @@
<item row="2" column="0">
<widget class="QLabel" name="SAKLabel">
<property name="text">
<string>SAK:</string>
<string notr="true">SAK:</string>
</property>
</widget>
</item>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/t55xxtab.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
<item>
<widget class="QRadioButton" name="Clone_T5555Button">
<property name="text">
<string>T5555</string>
<string notr="true">T5555</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="Clone_T55x7Button">
<property name="text">
<string>T55x7</string>
<string notr="true">T55x7</string>
</property>
<property name="checked">
<bool>true</bool>
Expand All @@ -61,7 +61,7 @@
<item>
<widget class="QGroupBox" name="Clone_EM410xGroupBox">
<property name="title">
<string>EM410x</string>
<string notr="true">EM410x</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
Expand Down

0 comments on commit b788d6a

Please sign in to comment.