[locale] Add properties for language and LC codes
- we already had the human-readable status strings, but also want the actual code (particularly for being able to **update** the code from QML)
This commit is contained in:
parent
fdbfbfe284
commit
75da1bece4
@ -288,6 +288,7 @@ Config::setLanguageExplicitly( const QString& language )
|
||||
m_selectedLocaleConfiguration.explicit_lang = true;
|
||||
|
||||
emit currentLanguageStatusChanged( currentLanguageStatus() );
|
||||
emit currentLanguageCodeChanged( currentLanguageCode() );
|
||||
}
|
||||
|
||||
void
|
||||
@ -306,6 +307,7 @@ Config::setLCLocaleExplicitly( const QString& locale )
|
||||
m_selectedLocaleConfiguration.explicit_lc = true;
|
||||
|
||||
emit currentLCStatusChanged( currentLCStatus() );
|
||||
emit currentLCCodeChanged( currentLCCode() );
|
||||
}
|
||||
|
||||
QString
|
||||
|
@ -43,9 +43,13 @@ class Config : public QObject
|
||||
Q_PROPERTY( const CalamaresUtils::Locale::TZZone* currentLocation READ currentLocation WRITE setCurrentLocation
|
||||
NOTIFY currentLocationChanged )
|
||||
|
||||
// Status are complete, human-readable, messages
|
||||
Q_PROPERTY( QString currentLocationStatus READ currentLocationStatus NOTIFY currentLanguageStatusChanged )
|
||||
Q_PROPERTY( QString currentLanguageStatus READ currentLanguageStatus NOTIFY currentLanguageStatusChanged )
|
||||
Q_PROPERTY( QString currentLCStatus READ currentLCStatus NOTIFY currentLCStatusChanged )
|
||||
// Code are internal identifiers, like "en_US.UTF-8"
|
||||
Q_PROPERTY( QString currentLanguageCode READ currentLanguageCode WRITE setLanguageExplicitly NOTIFY currentLanguageCodeChanged )
|
||||
Q_PROPERTY( QString currentLCCode READ currentLCCode WRITE setLCLocaleExplicitly NOTIFY currentLCCodeChanged )
|
||||
|
||||
public:
|
||||
Config( QObject* parent = nullptr );
|
||||
@ -103,11 +107,16 @@ public Q_SLOTS:
|
||||
*/
|
||||
void setCurrentLocation( const CalamaresUtils::Locale::TZZone* location );
|
||||
|
||||
QString currentLanguageCode() const { return localeConfiguration().language(); }
|
||||
QString currentLCCode() const { return localeConfiguration().lc_numeric; }
|
||||
|
||||
signals:
|
||||
void currentLocationChanged( const CalamaresUtils::Locale::TZZone* location ) const;
|
||||
void currentLocationStatusChanged( const QString& ) const;
|
||||
void currentLanguageStatusChanged( const QString& ) const;
|
||||
void currentLCStatusChanged( const QString& ) const;
|
||||
void currentLanguageCodeChanged( const QString& ) const;
|
||||
void currentLCCodeChanged( const QString& ) const;
|
||||
|
||||
private:
|
||||
/// A list of supported locale identifiers (e.g. "en_US.UTF-8")
|
||||
|
Loading…
Reference in New Issue
Block a user