[locale] Move status strings from Page to Config

- the config knows the status and how to describe it,
  fetch the strings from there.
This commit is contained in:
Adriaan de Groot 2020-07-21 15:51:49 +02:00
parent 855b21a7db
commit ef08ff6ac0
5 changed files with 43 additions and 34 deletions

View file

@ -22,6 +22,7 @@
#include "SetTimezoneJob.h"
#include "locale/Label.h"
#include "utils/Logger.h"
#include "utils/Variant.h"
@ -245,6 +246,33 @@ Config::setLCLocaleExplicitly( const QString& locale )
m_selectedLocaleConfiguration.explicit_lc = true;
}
std::pair< QString, QString >
Config::prettyLocaleStatus() const
{
using CalamaresUtils::Locale::Label;
Label lang( m_selectedLocaleConfiguration.language(), Label::LabelFormat::AlwaysWithCountry );
Label num( m_selectedLocaleConfiguration.lc_numeric, Label::LabelFormat::AlwaysWithCountry );
return std::make_pair< QString, QString >(
tr( "The system language will be set to %1." ).arg( lang.label() ),
tr( "The numbers and dates locale will be set to %1." ).arg( num.label() ) );
}
QString
Config::prettyStatus() const
{
QString br( QStringLiteral("<br/>"));
QString status;
status += tr( "Set timezone to %1/%2." ).arg( m_currentLocation->region(), m_currentLocation->zone() ) + br;
auto labels = prettyLocaleStatus();
status += labels.first + br;
status += labels.second + br;
return status;
}
void
Config::setConfigurationMap( const QVariantMap& configurationMap )