[libcalamares] Rename tr() functions to avoid confusing lupdate
This commit is contained in:
parent
e73f5fb9fe
commit
115f00f5cd
@ -378,7 +378,7 @@ LocaleTests::testTZLookup()
|
||||
|
||||
QVERIFY( zones.find( "America", "New_York" ) );
|
||||
QCOMPARE( zones.find( "America", "New_York" )->zone(), QStringLiteral( "New_York" ) );
|
||||
QCOMPARE( zones.find( "America", "New_York" )->tr(), QStringLiteral( "New York" ) );
|
||||
QCOMPARE( zones.find( "America", "New_York" )->translated(), QStringLiteral( "New York" ) );
|
||||
|
||||
QVERIFY( !zones.find( "Europe", "New_York" ) );
|
||||
QVERIFY( !zones.find( "America", "New York" ) );
|
||||
|
@ -76,7 +76,7 @@ TimeZoneData::TimeZoneData( const QString& region,
|
||||
}
|
||||
|
||||
QString
|
||||
TimeZoneData::tr() const
|
||||
TimeZoneData::translated() const
|
||||
{
|
||||
// NOTE: context name must match what's used in zone-extractor.py
|
||||
return QObject::tr( m_human, "tz_names" );
|
||||
@ -86,11 +86,11 @@ class RegionData : public TranslatableString
|
||||
{
|
||||
public:
|
||||
using TranslatableString::TranslatableString;
|
||||
QString tr() const override;
|
||||
QString translated() const override;
|
||||
};
|
||||
|
||||
QString
|
||||
RegionData::tr() const
|
||||
RegionData::translated() const
|
||||
{
|
||||
// NOTE: context name must match what's used in zone-extractor.py
|
||||
return QObject::tr( m_human, "tz_regions" );
|
||||
@ -276,7 +276,7 @@ RegionsModel::data( const QModelIndex& index, int role ) const
|
||||
const auto& region = m_private->m_regions[ index.row() ];
|
||||
if ( role == NameRole )
|
||||
{
|
||||
return region->tr();
|
||||
return region->translated();
|
||||
}
|
||||
if ( role == KeyRole )
|
||||
{
|
||||
@ -292,13 +292,13 @@ RegionsModel::roleNames() const
|
||||
}
|
||||
|
||||
QString
|
||||
RegionsModel::tr( const QString& region ) const
|
||||
RegionsModel::translated( const QString& region ) const
|
||||
{
|
||||
for ( const auto* p : m_private->m_regions )
|
||||
{
|
||||
if ( p->key() == region )
|
||||
{
|
||||
return p->tr();
|
||||
return p->translated();
|
||||
}
|
||||
}
|
||||
return region;
|
||||
@ -330,7 +330,7 @@ ZonesModel::data( const QModelIndex& index, int role ) const
|
||||
switch ( role )
|
||||
{
|
||||
case NameRole:
|
||||
return zone->tr();
|
||||
return zone->translated();
|
||||
case KeyRole:
|
||||
return zone->key();
|
||||
case RegionRole:
|
||||
|
@ -48,7 +48,7 @@ class TimeZoneData : public QObject, TranslatableString
|
||||
|
||||
Q_PROPERTY( QString region READ region CONSTANT )
|
||||
Q_PROPERTY( QString zone READ zone CONSTANT )
|
||||
Q_PROPERTY( QString name READ tr CONSTANT )
|
||||
Q_PROPERTY( QString name READ translated CONSTANT )
|
||||
Q_PROPERTY( QString countryCode READ country CONSTANT )
|
||||
|
||||
public:
|
||||
@ -60,7 +60,7 @@ public:
|
||||
TimeZoneData( const TimeZoneData& ) = delete;
|
||||
TimeZoneData( TimeZoneData&& ) = delete;
|
||||
|
||||
QString tr() const override;
|
||||
QString translated() const override;
|
||||
|
||||
QString region() const { return m_region; }
|
||||
QString zone() const { return key(); }
|
||||
@ -106,7 +106,7 @@ public Q_SLOTS:
|
||||
* Returns @p region unchanged if there is no such region
|
||||
* or no translation for the region's name.
|
||||
*/
|
||||
QString tr( const QString& region ) const;
|
||||
QString translated( const QString& region ) const;
|
||||
|
||||
private:
|
||||
Private* m_private;
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
virtual ~TranslatableString();
|
||||
|
||||
/// @brief Give the localized human-readable form
|
||||
virtual QString tr() const = 0;
|
||||
virtual QString translated() const = 0;
|
||||
QString key() const { return m_key; }
|
||||
|
||||
bool operator==( const TranslatableString& other ) const { return m_key == other.m_key; }
|
||||
|
@ -390,7 +390,7 @@ Config::currentTimezoneName() const
|
||||
{
|
||||
if ( m_currentLocation )
|
||||
{
|
||||
return m_regionModel->tr( m_currentLocation->region() ) + '/' + m_currentLocation->tr();
|
||||
return m_regionModel->translated( m_currentLocation->region() ) + '/' + m_currentLocation->translated();
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ TimeZoneWidget::paintEvent( QPaintEvent* )
|
||||
#else
|
||||
auto textwidth = [ & ]( const QString& s ) { return fontMetrics.width( s ); };
|
||||
#endif
|
||||
const int textWidth = textwidth( m_currentLocation ? m_currentLocation->tr() : QString() );
|
||||
const int textWidth = textwidth( m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
const int textHeight = fontMetrics.height();
|
||||
|
||||
QRect rect = QRect( point.x() - textWidth / 2 - 5, point.y() - textHeight - 8, textWidth + 10, textHeight - 2 );
|
||||
@ -170,7 +170,7 @@ TimeZoneWidget::paintEvent( QPaintEvent* )
|
||||
painter.setBrush( QColor( 40, 40, 40 ) );
|
||||
painter.drawRoundedRect( rect, 3, 3 );
|
||||
painter.setPen( Qt::white );
|
||||
painter.drawText( rect.x() + 5, rect.bottom() - 4, m_currentLocation ? m_currentLocation->tr() : QString() );
|
||||
painter.drawText( rect.x() + 5, rect.bottom() - 4, m_currentLocation ? m_currentLocation->translated() : QString() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user