Skip to content

Commit

Permalink
Localization
Browse files Browse the repository at this point in the history
- Added support to localization
- Integrated italian translation
- Translator credit in about section

*translation compiled file will stored in resource during compiling, .ts file will create in /lang_ts, .qm file must be putted in /lang/xx_XX/xx_XX.qm before compiling
  • Loading branch information
simopil committed Feb 16, 2019
1 parent eecb6b8 commit 0c0757f
Show file tree
Hide file tree
Showing 14 changed files with 1,193 additions and 568 deletions.
Binary file modified bin/suseprimeqt
Binary file not shown.
14 changes: 8 additions & 6 deletions src/about.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
#include "about.h"
#include "ui_about.h"
#include <QProcess>

static QString SUSEPrimeqt_versionstring = "SUSEPrimeQt 0.6.2";
static QString SUSEPrime_versionstring = "- Provides a simple GUI for SUSEPrime 0.6. Needs suse-prime >= 0.6";
#include <QTranslator>

about::about(QWidget *parent) :
QDialog(parent),
ui(new Ui::about)
{
ui->setupUi(this);
ui->retranslateUi(this);
QProcess get_usage;
get_usage.start("prime-select");
get_usage.waitForFinished(-1);
QString output = get_usage.readAllStandardOutput();
ui->info_usagebox->setText(output);
ui->ver_lab_str->setText(SUSEPrimeqt_versionstring);
ui->label_versiondesc->setText(SUSEPrime_versionstring);
ui->ver_lab_str->setText("SUSEPrimeQt 0.6.4");
ui->label_versiondesc->setText(tr("- Provides a simple GUI for SUSEPrime 0.6. Needs suse-prime >= 0.6"));
QString translation = QString(":/lang/%1/%1.qm").arg(QLocale::system().name());
QTranslator translator;
bool transl_exists = translator.load(translation);
if(transl_exists == false) ui->transl_about->hide();
}

about::~about()
{
delete ui;
Expand Down
58 changes: 40 additions & 18 deletions src/about.ui
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<property name="geometry">
<rect>
<x>470</x>
<y>10</y>
<y>5</y>
<width>100</width>
<height>16</height>
</rect>
Expand Down Expand Up @@ -68,7 +68,7 @@
<property name="geometry">
<rect>
<x>470</x>
<y>30</y>
<y>18</y>
<width>90</width>
<height>16</height>
</rect>
Expand Down Expand Up @@ -158,10 +158,42 @@
<string>SUSEPrimeqt vers</string>
</property>
</widget>
<widget class="QLabel" name="transl_about">
<property name="geometry">
<rect>
<x>470</x>
<y>40</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="text">
<string>Translated by:
name</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_versiondesc">
<item row="3" column="0">
<widget class="QTextBrowser" name="info_usagebox">
<property name="minimumSize">
<size>
<width>575</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -180,12 +212,12 @@
</font>
</property>
<property name="text">
<string>SUPrivides GUI for suse-prime x, SUSEPrime version x needed</string>
<string>Here a full command-line version usage and description</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_11">
<item row="1" column="0">
<widget class="QLabel" name="label_versiondesc">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand All @@ -204,17 +236,7 @@
</font>
</property>
<property name="text">
<string>Here a full command-line version usage and description</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QTextBrowser" name="info_usagebox">
<property name="minimumSize">
<size>
<width>575</width>
<height>0</height>
</size>
<string>DESCRIPTION+SUSEPRIME_VERSION_NEEDED string</string>
</property>
</widget>
</item>
Expand Down
Binary file added src/lang/it_IT/it_IT.qm
Binary file not shown.
Loading

0 comments on commit 0c0757f

Please sign in to comment.