[locale] Adapt to changed RegionZonePair

- add method that takes a pair directly
- don't act like a pair is a std::pair
This commit is contained in:
Adriaan de Groot 2024-02-19 22:59:31 +01:00
parent c09953e15e
commit 54250887e1
2 changed files with 16 additions and 4 deletions

View File

@ -233,7 +233,7 @@ Config::setCurrentLocation()
{ {
if ( !m_currentLocation && m_startingTimezone.isValid() ) if ( !m_currentLocation && m_startingTimezone.isValid() )
{ {
setCurrentLocation( m_startingTimezone.first, m_startingTimezone.second ); setCurrentLocation( m_startingTimezone );
} }
if ( !m_selectedLocaleConfiguration.explicit_lang ) if ( !m_selectedLocaleConfiguration.explicit_lang )
{ {
@ -248,10 +248,16 @@ Config::setCurrentLocation( const QString& regionzone )
auto r = Calamares::GeoIP::splitTZString( regionzone ); auto r = Calamares::GeoIP::splitTZString( regionzone );
if ( r.isValid() ) if ( r.isValid() )
{ {
setCurrentLocation( r.first, r.second ); setCurrentLocation( r );
} }
} }
void
Config::setCurrentLocation( const Calamares::GeoIP::RegionZonePair& tz )
{
setCurrentLocation( tz.region(), tz.zone() );
}
void void
Config::setCurrentLocation( const QString& regionName, const QString& zoneName ) Config::setCurrentLocation( const QString& regionName, const QString& zoneName )
{ {
@ -407,13 +413,15 @@ localeLabel( const QString& s )
QString QString
Config::currentLanguageStatus() const Config::currentLanguageStatus() const
{ {
return tr( "The system language will be set to %1.", "@info" ).arg( localeLabel( m_selectedLocaleConfiguration.language() ) ); return tr( "The system language will be set to %1.", "@info" )
.arg( localeLabel( m_selectedLocaleConfiguration.language() ) );
} }
QString QString
Config::currentLCStatus() const Config::currentLCStatus() const
{ {
return tr( "The numbers and dates locale will be set to %1.", "@info" ).arg( localeLabel( m_selectedLocaleConfiguration.lc_numeric ) ); return tr( "The numbers and dates locale will be set to %1.", "@info" )
.arg( localeLabel( m_selectedLocaleConfiguration.lc_numeric ) );
} }
QString QString

View File

@ -108,6 +108,7 @@ public Q_SLOTS:
* change the actual location. * change the actual location.
*/ */
void setCurrentLocation( const QString& regionzone ); void setCurrentLocation( const QString& regionzone );
/** @brief Sets a location by split name /** @brief Sets a location by split name
* *
* @p region should be "America" or the like, while @p zone * @p region should be "America" or the like, while @p zone
@ -115,6 +116,9 @@ public Q_SLOTS:
*/ */
void setCurrentLocation( const QString& region, const QString& zone ); void setCurrentLocation( const QString& region, const QString& zone );
/** @brief Sets a location by strongly-typed region+zone name */
void setCurrentLocation( const Calamares::GeoIP::RegionZonePair& tz );
/** @brief Sets a location by pointer to zone data. /** @brief Sets a location by pointer to zone data.
* *
*/ */