Skip to content

Commit

Permalink
Fix translations (#489)
Browse files Browse the repository at this point in the history
IB-5814

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma authored and iannaska committed Apr 2, 2019
1 parent 8fcdae1 commit e4852c9
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 48 deletions.
4 changes: 2 additions & 2 deletions client/dialogs/AddRecipients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ AddRecipients::AddRecipients(ItemList* itemList, QWidget *parent)
setWindowFlags( Qt::Dialog | Qt::CustomizeWindowHint );
setWindowModality( Qt::ApplicationModal );

ui->leftPane->init(ria::qdigidoc4::ToAddAdresses, tr("Add recipients"));
ui->leftPane->init(ria::qdigidoc4::ToAddAdresses, QStringLiteral("Add recipients"));
ui->leftPane->setFont(Styles::font(Styles::Regular, 20));
ui->rightPane->init(ria::qdigidoc4::AddedAdresses, tr("Added recipients"));
ui->rightPane->init(ria::qdigidoc4::AddedAdresses, QStringLiteral("Added recipients"));
ui->rightPane->setFont(Styles::font(Styles::Regular, 20));

ui->fromCard->setFont(Styles::font(Styles::Condensed, 12));
Expand Down
16 changes: 8 additions & 8 deletions client/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@
<source>Recipient’s certification chain contains certificates that are not trusted. Continue with encryption?</source>
<translation>Recipient’s certification chain contains certificates that are not trusted. Continue with encryption?</translation>
</message>
<message>
<source>Add recipients</source>
<translation>Add recipients</translation>
</message>
<message>
<source>Added recipients</source>
<translation>Added recipients</translation>
</message>
</context>
<context>
<name>AddressItem</name>
Expand Down Expand Up @@ -954,6 +946,14 @@ The Information System Authority does not retain information regarding the files
<source>Enter personal code, company or registry code</source>
<translation>Enter personal code, company or registry code</translation>
</message>
<message>
<source>Add recipients</source>
<translation>Add recipients</translation>
</message>
<message>
<source>Added recipients</source>
<translation>Added recipients</translation>
</message>
</context>
<context>
<name>KeyDialog</name>
Expand Down
16 changes: 8 additions & 8 deletions client/translations/et.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@
<source>Recipient’s certification chain contains certificates that are not trusted. Continue with encryption?</source>
<translation>Adressaadi sertifitseerimisahelas on mitteusaldatud sertifikaate. Jätkame krüpteerimist?</translation>
</message>
<message>
<source>Add recipients</source>
<translation>Lisa adressaadid</translation>
</message>
<message>
<source>Added recipients</source>
<translation>Lisatud adressaadid</translation>
</message>
</context>
<context>
<name>AddressItem</name>
Expand Down Expand Up @@ -954,6 +946,14 @@ Riigi Infosüsteemi Amet ei säilita informatsiooni teenuse kasutajate ja failid
<source>Enter personal code, company or registry code</source>
<translation>Sisesta isikukood, asutus või registrikood</translation>
</message>
<message>
<source>Add recipients</source>
<translation>Lisa adressaadid</translation>
</message>
<message>
<source>Added recipients</source>
<translation>Lisatud adressaadid</translation>
</message>
</context>
<context>
<name>KeyDialog</name>
Expand Down
16 changes: 8 additions & 8 deletions client/translations/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@
<source>Recipient’s certification chain contains certificates that are not trusted. Continue with encryption?</source>
<translation>Цепочка сертификатов получателя содержит ненадежные сертификаты. Продолжить шифрование?</translation>
</message>
<message>
<source>Add recipients</source>
<translation>Добавьте получателей</translation>
</message>
<message>
<source>Added recipients</source>
<translation>Добавлен получатель</translation>
</message>
</context>
<context>
<name>AddressItem</name>
Expand Down Expand Up @@ -955,6 +947,14 @@ The Information System Authority does not retain information regarding the files
<source>Enter personal code, company or registry code</source>
<translation>Введите личный код, учреждение или код регистра</translation>
</message>
<message>
<source>Add recipients</source>
<translation>Добавьте получателей</translation>
</message>
<message>
<source>Added recipients</source>
<translation>Добавлен получатель</translation>
</message>
</context>
<context>
<name>KeyDialog</name>
Expand Down
27 changes: 13 additions & 14 deletions client/widgets/AddressItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,14 @@ AddressItem::AddressItem(CKey k, QWidget *parent, bool showIcon)

QString type, strDate;

auto certType = SslCertificate(key.cert).type();
if(certType & SslCertificate::DigiIDType)
type = tr("Digi-ID");
else if(certType & SslCertificate::EstEidType)
type = tr("ID-card");
else if(certType & SslCertificate::TempelType)
type = tr("e-Seal");
else if(certType & SslCertificate::MobileIDType)
type = tr("Mobile-ID");

if(!showIcon)
{
DateTime date(key.cert.expiryDate().toLocalTime());
if(!date.isNull())
strDate = date.formatDate(QStringLiteral("dd. MMMM yyyy"));
}

update(name.toHtmlEscaped(), SslCertificate(key.cert).personalCode(), type, strDate, AddressItem::Remove);
update(name.toHtmlEscaped(), SslCertificate(key.cert).personalCode(), SslCertificate(key.cert).type(), strDate, AddressItem::Remove);
}

AddressItem::~AddressItem()
Expand Down Expand Up @@ -206,9 +196,9 @@ void AddressItem::stateChange(ContainerState state)
ui->remove->setVisible(state == UnencryptedContainer);
}

void AddressItem::update(const QString& cardName, const QString& cardCode, const QString& type, const QString& strDate, ShowToolButton show)
void AddressItem::update(const QString& cardName, const QString& cardCode, SslCertificate::CertType type, const QString& strDate, ShowToolButton show)
{
typeText = type;
m_type = type;
expireDateText = strDate;
code = cardCode;
name = cardName;
Expand All @@ -222,7 +212,16 @@ void AddressItem::setIdType()
{
QString str;
QTextStream st(&str);
st << tr(qPrintable(typeText));
QString typeText;
if(m_type & SslCertificate::DigiIDType)
typeText = tr("Digi-ID");
else if(m_type & SslCertificate::EstEidType)
typeText = tr("ID-card");
else if(m_type & SslCertificate::TempelType)
typeText = tr("e-Seal");
else if(m_type & SslCertificate::MobileIDType)
typeText = tr("Mobile-ID");
st << typeText;

if(!expireDateText.isEmpty())
{
Expand Down
6 changes: 4 additions & 2 deletions client/widgets/AddressItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "crypto/CryptoDoc.h"
#include "widgets/Item.h"

#include <common/SslCertificate.h>

#include <memory>

namespace Ui {
Expand Down Expand Up @@ -52,7 +54,7 @@ class AddressItem : public Item
void idChanged(const QString& cardCode, const QString& mobileCode, const QByteArray& serialNumber) override;
void showButton(ShowToolButton show);
void stateChange(ria::qdigidoc4::ContainerState state) override;
void update(const QString& name, const QString& code, const QString &type, const QString& strDate, ShowToolButton show);
void update(const QString& name, const QString& code, SslCertificate::CertType type, const QString& strDate, ShowToolButton show);

protected:
void changeEvent(QEvent* event) override;
Expand All @@ -74,7 +76,7 @@ class AddressItem : public Item
std::unique_ptr<QFontMetrics> nameMetrics;
int nameWidth = 0;
int reservedWidth = false;
QString typeText;
SslCertificate::CertType m_type;
QString expireDateText;
bool yourself = false;
};
14 changes: 8 additions & 6 deletions client/widgets/ItemList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ItemList::ItemList(QWidget *parent)
ui->download->hide();
ui->count->setFont(Styles::font(Styles::Condensed, 12));
ui->count->hide();
connect(this, &ItemList::idChanged, [this](const QString &code, const QString &mobile, const QByteArray& serial)
connect(this, &ItemList::idChanged, this, [this](const QString &code, const QString &mobile, const QByteArray& serial)
{idCode = code; mobileCode = mobile; serialNumber = serial;});
}

Expand All @@ -57,8 +57,8 @@ void ItemList::addHeader(const QString &label)
header->resize(415, 64);
header->setFixedHeight(64);
header->setFont( Styles::font(Styles::Regular, 20));
header->setStyleSheet("border: solid rgba(217, 217, 216, 0.45);"
"border-width: 0px 0px 1px 0px;");
header->setStyleSheet(QStringLiteral("border: solid rgba(217, 217, 216, 0.45);"
"border-width: 0px 0px 1px 0px;"));
ui->itemLayout->insertWidget(0, header);
headerItems++;
}
Expand All @@ -73,6 +73,8 @@ void ItemList::changeEvent(QEvent* event)
{
if (event->type() == QEvent::LanguageChange)
{
tr("Add recipients");
tr("Added recipients");
tr("Recipients");
tr("Encrypted files");
tr("Container is not signed");
Expand All @@ -85,7 +87,7 @@ void ItemList::changeEvent(QEvent* event)
ui->listHeader->setText(tr(qPrintable(listText)));
ui->txtFind->setPlaceholderText(tr("Enter the personal code, institution or registry code"));

if(header != nullptr)
if(header)
header->setText(tr(qPrintable(headerText)));

ui->add->setText(addLabel());
Expand Down Expand Up @@ -201,8 +203,8 @@ void ItemList::init(ItemType item, const QString &header)
ui->txtFind->setFont(Styles::font(Styles::Regular, 12));
ui->findGroup->show();
ui->txtFind->setPlaceholderText(tr("Enter personal code, company or registry code"));
connect(ui->txtFind, &QLineEdit::returnPressed, [this](){ emit search(ui->txtFind->text()); });
connect(ui->btnFind, &QPushButton::clicked, [this](){ emit search(ui->txtFind->text()); });
connect(ui->txtFind, &QLineEdit::returnPressed, [this]{ emit search(ui->txtFind->text()); });
connect(ui->btnFind, &QPushButton::clicked, [this]{ emit search(ui->txtFind->text()); });
ui->btnFind->setDisabled(ui->txtFind->text().isEmpty());
connect(ui->txtFind, &QLineEdit::textChanged, [=](const QString &text){
ui->btnFind->setDisabled(text.isEmpty());
Expand Down

0 comments on commit e4852c9

Please sign in to comment.