mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-03 04:15:37 -04:00
[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
2 changed files with 11 additions and 0 deletions
|
@ -288,6 +288,7 @@ Config::setLanguageExplicitly( const QString& language )
|
||||||
m_selectedLocaleConfiguration.explicit_lang = true;
|
m_selectedLocaleConfiguration.explicit_lang = true;
|
||||||
|
|
||||||
emit currentLanguageStatusChanged( currentLanguageStatus() );
|
emit currentLanguageStatusChanged( currentLanguageStatus() );
|
||||||
|
emit currentLanguageCodeChanged( currentLanguageCode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -306,6 +307,7 @@ Config::setLCLocaleExplicitly( const QString& locale )
|
||||||
m_selectedLocaleConfiguration.explicit_lc = true;
|
m_selectedLocaleConfiguration.explicit_lc = true;
|
||||||
|
|
||||||
emit currentLCStatusChanged( currentLCStatus() );
|
emit currentLCStatusChanged( currentLCStatus() );
|
||||||
|
emit currentLCCodeChanged( currentLCCode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
|
|
|
@ -43,9 +43,13 @@ class Config : public QObject
|
||||||
Q_PROPERTY( const CalamaresUtils::Locale::TZZone* currentLocation READ currentLocation WRITE setCurrentLocation
|
Q_PROPERTY( const CalamaresUtils::Locale::TZZone* currentLocation READ currentLocation WRITE setCurrentLocation
|
||||||
NOTIFY currentLocationChanged )
|
NOTIFY currentLocationChanged )
|
||||||
|
|
||||||
|
// Status are complete, human-readable, messages
|
||||||
Q_PROPERTY( QString currentLocationStatus READ currentLocationStatus NOTIFY currentLanguageStatusChanged )
|
Q_PROPERTY( QString currentLocationStatus READ currentLocationStatus NOTIFY currentLanguageStatusChanged )
|
||||||
Q_PROPERTY( QString currentLanguageStatus READ currentLanguageStatus NOTIFY currentLanguageStatusChanged )
|
Q_PROPERTY( QString currentLanguageStatus READ currentLanguageStatus NOTIFY currentLanguageStatusChanged )
|
||||||
Q_PROPERTY( QString currentLCStatus READ currentLCStatus NOTIFY currentLCStatusChanged )
|
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:
|
public:
|
||||||
Config( QObject* parent = nullptr );
|
Config( QObject* parent = nullptr );
|
||||||
|
@ -103,11 +107,16 @@ public Q_SLOTS:
|
||||||
*/
|
*/
|
||||||
void setCurrentLocation( const CalamaresUtils::Locale::TZZone* location );
|
void setCurrentLocation( const CalamaresUtils::Locale::TZZone* location );
|
||||||
|
|
||||||
|
QString currentLanguageCode() const { return localeConfiguration().language(); }
|
||||||
|
QString currentLCCode() const { return localeConfiguration().lc_numeric; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void currentLocationChanged( const CalamaresUtils::Locale::TZZone* location ) const;
|
void currentLocationChanged( const CalamaresUtils::Locale::TZZone* location ) const;
|
||||||
void currentLocationStatusChanged( const QString& ) const;
|
void currentLocationStatusChanged( const QString& ) const;
|
||||||
void currentLanguageStatusChanged( const QString& ) const;
|
void currentLanguageStatusChanged( const QString& ) const;
|
||||||
void currentLCStatusChanged( const QString& ) const;
|
void currentLCStatusChanged( const QString& ) const;
|
||||||
|
void currentLanguageCodeChanged( const QString& ) const;
|
||||||
|
void currentLCCodeChanged( const QString& ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// A list of supported locale identifiers (e.g. "en_US.UTF-8")
|
/// A list of supported locale identifiers (e.g. "en_US.UTF-8")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue