A subclass of QTranslator with extended file search capabilities.
More...
|
| QtlTranslator (const QString &fileNamePrefix, const QString &localeName=QString(), const QStringList &directories=QStringList(), QObject *parent=0) |
| Constructor. More...
|
|
|
static QStringList | loadedLocales () |
| Get the list of all loaded locales using this class. More...
|
|
static QString | searchLocaleFile (const QString &fileName) |
| Search a locale variant of a file, based on all loaded locales. More...
|
|
A subclass of QTranslator with extended file search capabilities.
◆ QtlTranslator() [1/2]
QtlTranslator::QtlTranslator |
( |
const QString & |
fileNamePrefix, |
|
|
const QString & |
localeName = QString() , |
|
|
const QStringList & |
directories = QStringList() , |
|
|
QObject * |
parent = 0 |
|
) |
| |
|
explicit |
Constructor.
The translator is automatically installed in the application.
- Parameters
-
[in] | fileNamePrefix | Same as the filename parameter in QTranslator::load() without the locale name part. |
[in] | localeName | Locale name. Defaults to the system locale. |
[in] | directories | List of directories to search for the file. The Qt translation directory is automatically added at the end of the list. |
[in] | parent | Optional parent object. |
◆ QtlTranslator() [2/2]
QtlTranslator::QtlTranslator |
( |
| ) |
|
|
private |
◆ loadedLocales()
QStringList QtlTranslator::loadedLocales |
( |
| ) |
|
|
static |
Get the list of all loaded locales using this class.
- Returns
- The list of all loaded locales using this class, most recent first. This list is never empty, its last element is the system locale.
◆ searchLocaleFile()
QString QtlTranslator::searchLocaleFile |
( |
const QString & |
fileName | ) |
|
|
static |
Search a locale variant of a file, based on all loaded locales.
In the list of all loaded locales, seach the first existing file in the form {basename}_{locale}.{suffix}.
- Parameters
-
- Returns
- The first existing locale variant or fileName if none is found.
◆ _loadedLocales
QStringList QtlTranslator::_loadedLocales |
|
staticprivate |
◆ _loadedLocalesMutex
QMutex QtlTranslator::_loadedLocalesMutex |
|
staticprivate |
Synchronize access to _loadedLocales.
The documentation for this class was generated from the following files: