mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-27 02:04:39 +00:00
added support method for getting current languages values
This commit is contained in:
parent
b6d3b0f72e
commit
f466dd6437
12
locales.cpp
12
locales.cpp
@ -40,9 +40,16 @@ bool Locales::setLocalePrivate(const QLocale &locale) {
|
||||
}
|
||||
emit sigTranslationChanged();
|
||||
|
||||
_currentLocate = locale;
|
||||
|
||||
return _translations.size();
|
||||
}
|
||||
|
||||
const QLocale &Locales::currentLocate() {
|
||||
auto obj = instance();
|
||||
return obj->currentLocatePrivate();
|
||||
}
|
||||
|
||||
bool Locales::setLocale(const QLocale &locale) {
|
||||
auto obj = instance();
|
||||
return obj->setLocalePrivate(locale);
|
||||
@ -78,12 +85,17 @@ void Locales::removeOldTranslation() {
|
||||
QCoreApplication::removeTranslator(tr);
|
||||
delete tr;
|
||||
}
|
||||
_translations.clear();
|
||||
}
|
||||
|
||||
void Locales::addLocationPrivate(const QString &location) {
|
||||
_locations += location;
|
||||
}
|
||||
|
||||
const QLocale &Locales::currentLocatePrivate() const {
|
||||
return _currentLocate;
|
||||
|
||||
}
|
||||
void Locales::addLocation(const QString &location) {
|
||||
auto obj = instance();
|
||||
obj->addLocationPrivate(location);
|
||||
|
@ -66,6 +66,12 @@ public:
|
||||
*/
|
||||
static Locales *instance();
|
||||
|
||||
/**
|
||||
* @brief currentLocate This method return current locate of applicatuon.
|
||||
* @return current or last sets locate of applciation.
|
||||
*/
|
||||
static const QLocale ¤tLocate();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief sigTranslationChanged Emited when set new locale for application.
|
||||
@ -82,6 +88,9 @@ private:
|
||||
void removeOldTranslation();
|
||||
void addLocationPrivate(const QString& location);
|
||||
|
||||
const QLocale ¤tLocatePrivate() const;
|
||||
|
||||
QLocale _currentLocate;
|
||||
QSet<QString> _locations;
|
||||
QList<QTranslator *> _translations;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user