A class to track and manage language and locale settings and available translations.
More...
|
| TorcLanguage (TorcSetting *SettingParent) |
|
virtual | ~TorcLanguage () |
|
QLocale | GetLocale (void) |
|
QString | GetUIName (void) |
|
| TorcHTTPService (QObject *Parent, const QString &Signature, const QString &Name, const QMetaObject &MetaObject, const QString &Blacklist=QStringLiteral("")) |
|
virtual | ~TorcHTTPService () |
|
void | ProcessHTTPRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override |
|
QVariantMap | ProcessRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override |
|
QString | GetMethod (int Index) |
|
QVariant | GetProperty (int Index) |
| Get the value of a given property. More...
|
|
QVariantMap | GetServiceDetails (void) |
| Return a QVariantMap describing the services methods and properties. More...
|
|
virtual QString | GetPresentationURL (void) |
|
Public Member Functions inherited from TorcHTTPHandler |
| TorcHTTPHandler (const QString &Signature, const QString &Name) |
|
virtual | ~TorcHTTPHandler () |
|
QString | Signature (void) const |
|
bool | GetRecursive (void) const |
|
QString | Name (void) const |
|
|
static QString | ToString (QLocale::Language Language, bool Empty=false) |
| Return a user readable string for the current language. More...
|
|
static QLocale::Language | From2CharCode (const char *Code) |
| Return the language associated with the given 2 character code. More...
|
|
static QLocale::Language | From2CharCode (const QString &Code) |
| Return the language associated with the given 2 character code. More...
|
|
static QLocale::Language | From3CharCode (const char *Code) |
| Return the language associated with the given 3 character code. More...
|
|
static QLocale::Language | From3CharCode (const QString &Code) |
| Return the language associated with the given 3 character code. More...
|
|
A class to track and manage language and locale settings and available translations.
TorcLanguage uses the 2 or 4 character language/country code to identify a language (e.g. en_GB, en_US, en). If a specific language has not been set in the settings database, the system language will be used (with a final fallback to en_GB). The current language can be set with SetLanguageCode and retrieved with GetLanguageCode. GetLanguageString returns a translated, user presentable string naming the language.
GetLanguages returns a list of available translations.
GetTranslation provides a context sensitive translation service for strings. It is intended for dynamically translated strings (e.g. plurals) retrieved via the HTTP interface. Other strings should be loaded once only.
Various utility functions are available for interfacing with 3rd party libraries (From2CharCode etc).
TorcLanguage is available from QML via QAbstractListModel inheritance and from the HTTP interface via TorcHTTPService.
- Todo:
Check whether QTranslator::load is thread safe.
Add support for multiple translation files (e.g. plugins as well ).
Definition at line 17 of file torclanguage.h.