mirror of
https://github.com/QuasarApp/QuasarAppLib.git
synced 2025-04-27 10:14:38 +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();
|
emit sigTranslationChanged();
|
||||||
|
|
||||||
|
_currentLocate = locale;
|
||||||
|
|
||||||
return _translations.size();
|
return _translations.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QLocale &Locales::currentLocate() {
|
||||||
|
auto obj = instance();
|
||||||
|
return obj->currentLocatePrivate();
|
||||||
|
}
|
||||||
|
|
||||||
bool Locales::setLocale(const QLocale &locale) {
|
bool Locales::setLocale(const QLocale &locale) {
|
||||||
auto obj = instance();
|
auto obj = instance();
|
||||||
return obj->setLocalePrivate(locale);
|
return obj->setLocalePrivate(locale);
|
||||||
@ -78,12 +85,17 @@ void Locales::removeOldTranslation() {
|
|||||||
QCoreApplication::removeTranslator(tr);
|
QCoreApplication::removeTranslator(tr);
|
||||||
delete tr;
|
delete tr;
|
||||||
}
|
}
|
||||||
|
_translations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Locales::addLocationPrivate(const QString &location) {
|
void Locales::addLocationPrivate(const QString &location) {
|
||||||
_locations += location;
|
_locations += location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QLocale &Locales::currentLocatePrivate() const {
|
||||||
|
return _currentLocate;
|
||||||
|
|
||||||
|
}
|
||||||
void Locales::addLocation(const QString &location) {
|
void Locales::addLocation(const QString &location) {
|
||||||
auto obj = instance();
|
auto obj = instance();
|
||||||
obj->addLocationPrivate(location);
|
obj->addLocationPrivate(location);
|
||||||
|
@ -66,6 +66,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
static Locales *instance();
|
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:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief sigTranslationChanged Emited when set new locale for application.
|
* @brief sigTranslationChanged Emited when set new locale for application.
|
||||||
@ -82,6 +88,9 @@ private:
|
|||||||
void removeOldTranslation();
|
void removeOldTranslation();
|
||||||
void addLocationPrivate(const QString& location);
|
void addLocationPrivate(const QString& location);
|
||||||
|
|
||||||
|
const QLocale ¤tLocatePrivate() const;
|
||||||
|
|
||||||
|
QLocale _currentLocate;
|
||||||
QSet<QString> _locations;
|
QSet<QString> _locations;
|
||||||
QList<QTranslator *> _translations;
|
QList<QTranslator *> _translations;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user