Browse Source

Merge pull request #9938 from Chocobo1/tr

Fix translation issues
adaptive-webui-19844
Mike Tzou 6 years ago committed by GitHub
parent
commit
1baa71c97a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/base/net/geoipmanager.cpp
  2. 18
      src/gui/optionsdialog.cpp
  3. 6
      src/gui/search/searchlistdelegate.cpp
  4. 2
      src/gui/search/searchlistdelegate.h

10
src/base/net/geoipmanager.cpp

@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
#include <QDir>
#include <QFile>
#include <QHostAddress>
#include <QLocale>
#include "base/logger.h"
#include "base/preferences.h"
@ -100,12 +101,15 @@ void GeoIPManager::loadDatabase() @@ -100,12 +101,15 @@ void GeoIPManager::loadDatabase()
QString error;
m_geoIPDatabase = GeoIPDatabase::load(filepath, error);
if (m_geoIPDatabase)
if (m_geoIPDatabase) {
const QLocale locale {Preferences::instance()->getLocale()};
Logger::instance()->addMessage(tr("GeoIP database loaded. Type: %1. Build time: %2.")
.arg(m_geoIPDatabase->type(), m_geoIPDatabase->buildEpoch().toString()),
.arg(m_geoIPDatabase->type(), locale.toString(m_geoIPDatabase->buildEpoch())),
Log::INFO);
else
}
else {
Logger::instance()->addMessage(tr("Couldn't load GeoIP database. Reason: %1").arg(error), Log::WARNING);
}
manageDatabaseUpdate();
}

18
src/gui/optionsdialog.cpp

@ -71,6 +71,21 @@ @@ -71,6 +71,21 @@
#include "ui_optionsdialog.h"
#include "utils.h"
namespace
{
QStringList translatedWeekdayNames()
{
// return translated strings from Monday to Sunday in user selected locale
const QLocale locale {Preferences::instance()->getLocale()};
const QDate date {2018, 11, 5}; // Monday
QStringList ret;
for (int i = 0; i < 7; ++i)
ret.append(locale.toString(date.addDays(i), "dddd"));
return ret;
}
}
class WheelEventEater : public QObject
{
public:
@ -164,8 +179,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) @@ -164,8 +179,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
initializeLanguageCombo();
// Load week days (scheduler)
for (uint i = 1; i <= 7; ++i)
m_ui->comboBoxScheduleDays->addItem(QDate::longDayName(i, QDate::StandaloneFormat));
m_ui->comboBoxScheduleDays->addItems(translatedWeekdayNames());
// Load options
loadOptions();

6
src/gui/search/searchlistdelegate.cpp

@ -37,10 +37,6 @@ @@ -37,10 +37,6 @@
#include "base/utils/misc.h"
#include "searchsortmodel.h"
namespace
{
const char i18nContext[] = "SearchListDelegate";
}
SearchListDelegate::SearchListDelegate(QObject *parent)
: QItemDelegate(parent)
@ -63,7 +59,7 @@ void SearchListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op @@ -63,7 +59,7 @@ void SearchListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
case SearchSortModel::LEECHES:
opt.displayAlignment = Qt::AlignRight | Qt::AlignVCenter;
QItemDelegate::drawDisplay(painter, opt, option.rect
, (index.data().toLongLong() >= 0) ? index.data().toString() : QCoreApplication::translate(i18nContext, "Unknown"));
, (index.data().toLongLong() >= 0) ? index.data().toString() : tr("Unknown"));
break;
default:
QItemDelegate::paint(painter, option, index);

2
src/gui/search/searchlistdelegate.h

@ -33,6 +33,8 @@ @@ -33,6 +33,8 @@
class SearchListDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit SearchListDelegate(QObject *parent);

Loading…
Cancel
Save