![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
Functions | |
| QList< QString > | qtTranslationCandidates () |
| Every directory that may hold Qt's own translations, in order of preference. | |
| QList< QString > | qtTranslationPaths () |
| The candidates that actually exist, most likely first, so no caller searches a path that is not there. | |
| QList< QString > | applicationTranslationPaths (const QString &_installedPath) |
| The directories to search for an application's own translation files, in order of preference. | |
| TranslationLoadResult | loadFrom (QTranslator &_translator, const QString &_nameHint, const QList< QString > &_directories) |
| Loads the first _nameHint + language translation file found in _directories into _translator. | |
| TranslationLoadResult | loadQt (QTranslator &_translator, const QString &_lang) |
| Loads Qt's own translation for _lang, which covers the strings of Qt's own dialogs. | |
| QList< QString > | availableLanguages (const QString &_prefix, const QList< QString > &_directories) |
| The language codes of the <prefix><lang>.qm files in _directories, sorted by code. | |
| TranslationLoadResult | loadApplication (QTranslator &_translator, const QString &_prefix, const QString &_lang, const QList< QString > &_directories) |
| Loads the <prefix><_lang>.qm translation file from _directories into _translator. | |
| QList< QString > TranslationLoader::applicationTranslationPaths | ( | const QString & | _installedPath | ) |
The directories to search for an application's own translation files, in order of preference.
| _installedPath | The location the platform installs the translation files in, derived from the executable's path. |
| QList< QString > TranslationLoader::availableLanguages | ( | const QString & | _prefix, |
| const QList< QString > & | _directories ) |
The language codes of the <prefix><lang>.qm files in _directories, sorted by code.
Lets a language selector offer exactly the languages that can be loaded.
| TranslationLoadResult TranslationLoader::loadApplication | ( | QTranslator & | _translator, |
| const QString & | _prefix, | ||
| const QString & | _lang, | ||
| const QList< QString > & | _directories ) |
Loads the <prefix><_lang>.qm translation file from _directories into _translator.
| _translator | The translator to load into; must not also be used for Qt's own translation. |
| _prefix | The translation file prefix, e.g. "cockatrice" or "oracle". |
| _lang | The language code, e.g. "de". An empty language loads nothing. |
| _directories | The directories to search, in order of preference. |
| TranslationLoadResult TranslationLoader::loadFrom | ( | QTranslator & | _translator, |
| const QString & | _nameHint, | ||
| const QList< QString > & | _directories ) |
Loads the first _nameHint + language translation file found in _directories into _translator.
QTranslator discards whatever it held before every load, so each translation file needs its own translator; loading a second file into the first one silently drops the first.
| _translator | The translator to load into. |
| _nameHint | The translation file name without its language and suffix, e.g. "qt_de" or "cockatrice_de". |
| _directories | The directories to search, in order of preference. |
| TranslationLoadResult TranslationLoader::loadQt | ( | QTranslator & | _translator, |
| const QString & | _lang ) |
Loads Qt's own translation for _lang, which covers the strings of Qt's own dialogs.
| _translator | The translator to load into; must not also be used for an application translation. |
| _lang | The language code, e.g. "de". An empty language loads nothing. |
| QList< QString > TranslationLoader::qtTranslationCandidates | ( | ) |
Every directory that may hold Qt's own translations, in order of preference.
More than one entry is needed because a relocated Qt (Flatpak, AppImage, a bundled SDK) can report a prefix-relative translations path that does not exist: the KDE runtime reports /usr/translations while its qt_*.qm files live in /usr/share/qt6/translations.
| QList< QString > TranslationLoader::qtTranslationPaths | ( | ) |
The candidates that actually exist, most likely first, so no caller searches a path that is not there.