Qt Utilities: QtUtilities::TranslationFiles Namespace Reference

Qt Utilities 6.19.1 Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models

Loading...
Searching...
No Matches
Functions
QtUtilities::TranslationFiles Namespace Reference

Convenience functions to load translations for Qt and the application. More...

## Functions
QT_UTILITIES_EXPORT QString & | additionalTranslationFilePath ()
| Allows to set an additional search path for translation files.
QT_UTILITIES_EXPORT void | loadQtTranslationFile (std::initializer_list< QString > repositoryNames)
| Loads and installs the appropriate Qt translation file for the current locale.
QT_UTILITIES_EXPORT void | loadQtTranslationFile (std::initializer_list< QString > repositoryNames, const QString &localeName)
QT_UTILITIES_EXPORT void | loadApplicationTranslationFile (const QString &configName, const QString &applicationName)
| Loads and installs the appropriate application translation file for the current locale.
QT_UTILITIES_EXPORT void | loadApplicationTranslationFile (const QString &configName, const QString &applicationName, const QString &localeName)
| Loads and installs the appropriate application translation file for the specified locale.
QT_UTILITIES_EXPORT void | loadApplicationTranslationFile (const QString &configName, const std::initializer_list< QString > &applicationNames)
| Loads and installs the appropriate application translation file for the current locale.
QT_UTILITIES_EXPORT void | loadApplicationTranslationFile (const QString &configName, const std::initializer_list< QString > &applicationNames, const QString &localeName)
| Loads and installs the appropriate application translation file for the specified locale.
QT_UTILITIES_EXPORT void | clearTranslationFiles ()
| Clears all translation files previously loaded via the load-functions in this namespace.
void | loadQtTranslationFile (initializer_list< QString > repositoryNames, const QString &localeName)
| Loads and installs the appropriate Qt translation file for the specified locale.

## Detailed Description

Convenience functions to load translations for Qt and the application.

## Function Documentation

## ◆ additionalTranslationFilePath()

QString & QtUtilities::TranslationFiles::additionalTranslationFilePath | ( |  | ) |

Allows to set an additional search path for translation files.

Remarks
  This path is considered before the default directories.

Definition at line 89 of file resources.cpp.

## ◆ clearTranslationFiles()

void QtUtilities::TranslationFiles::clearTranslationFiles | ( |  | ) |

Clears all translation files previously loaded via the load-functions in this namespace.

Definition at line 338 of file resources.cpp.

## ◆ loadApplicationTranslationFile() [1/4]

void QtUtilities::TranslationFiles::loadApplicationTranslationFile | ( | const QString & | configName,
|  | const QString & | applicationName )

Loads and installs the appropriate application translation file for the current locale.

Parameters

  configName | Specifies the name of the build configuration, e.g. an empty string or "debug-qt6".
  applicationName | Specifies the name of the application or additional library, e.g. "tageditor" or "qtutilities".

Remarks
  - Translation files have to be placed in one of the following locations:
    - ./
    - ../$application
    - ../../$application
    - ./translations
    - ../share/$application/translations
    - $install_prefix/share/$application/translations
  - Translation files must be named using the following scheme:
    - $application_$language.qm
  - Translation files can also be built-in using by setting the CMake variable BUILTIN_TRANSLATIONS. In this case it is also necessary to load the translations using this function.

Definition at line 210 of file resources.cpp.

## ◆ loadApplicationTranslationFile() [2/4]

void QtUtilities::TranslationFiles::loadApplicationTranslationFile | ( | const QString & | configName,
|  | const QString & | applicationName,
|  | const QString & | localeName )

Loads and installs the appropriate application translation file for the specified locale.

Parameters

  configName | Specifies the name of the build configuration, e.g. an empty string or "debug-qt6".
  applicationName | Specifies the name of the application or additional library, e.g. "tageditor" or "qtutilities".
  localeName | Specifies the name of the locale, e.g. "de_DE".

Remarks
  - Translation files have to be placed in one of the following locations:
    - ./
    - ../$application
    - ../../$application
    - ./translations
    - ../share/$application/translations
    - $install_prefix/share/$application/translations
  - Translation files must be named using the following scheme:
    - $application_$language.qm
  - Translation files can also be built-in using by setting the CMake variable BUILTIN_TRANSLATIONS. In this case it is also necessary to load the translations using this function.

Definition at line 268 of file resources.cpp.

## ◆ loadApplicationTranslationFile() [3/4]

void QtUtilities::TranslationFiles::loadApplicationTranslationFile | ( | const QString & | configName,
|  | const std::initializer_list< QString > & | applicationNames )

Loads and installs the appropriate application translation file for the current locale.

Parameters

  configName | Specifies the name of the build configuration, e.g. an empty string or "debug-qt6".
  applicationNames | Specifies the names of the applications and libraries, e.g. {"qtutilities", "tageditor"}.

Definition at line 314 of file resources.cpp.

## ◆ loadApplicationTranslationFile() [4/4]

void QtUtilities::TranslationFiles::loadApplicationTranslationFile | ( | const QString & | configName,
|  | const std::initializer_list< QString > & | applicationNames,
|  | const QString & | localeName )

Loads and installs the appropriate application translation file for the specified locale.

Parameters

  configName | Specifies the name of the build configuration, e.g. an empty string or "debug-qt6".
  applicationNames | Specifies the names of the applications and libraries, e.g. {"qtutilities", "tageditor"}.
  localeName | Specifies the name of the locale.

Definition at line 328 of file resources.cpp.

## ◆ loadQtTranslationFile() [1/3]

void QtUtilities::TranslationFiles::loadQtTranslationFile | ( | initializer_list< QString > | repositoryNames,
|  | const QString & | localeName )

Loads and installs the appropriate Qt translation file for the specified locale.

Parameters

  repositoryNames | Specifies the names of the Qt repositories to load translations for (e.g. "qtbase", "qtdeclarative", ...).
  localeName | Specifies the name of the locale.

Remarks
  - Translation files have to be placed in one of the following locations:
    - QLibraryInfo::location(QLibraryInfo::TranslationsPath) (used in UNIX)
    - ../share/qt/translations (used in Windows)
  - Translation files can also be built-in using by setting the CMake variable BUILTIN_TRANSLATIONS. In this case it is also necessary to load the translations using this function.

Definition at line 143 of file resources.cpp.

## ◆ loadQtTranslationFile() [2/3]

void QtUtilities::TranslationFiles::loadQtTranslationFile | ( | std::initializer_list< QString > | repositoryNames | ) |

Loads and installs the appropriate Qt translation file for the current locale.

Parameters

  repositoryNames | Specifies the names of the Qt repositories to load translations for (e.g. "qtbase", "qtdeclarative", ...).

Remarks
  - Translation files have to be placed in one of the following locations:
    - QLibraryInfo::location(QLibraryInfo::TranslationsPath) (used in UNIX)
    - ../share/qt/translations (used in Windows)
  - Translation files can also be built-in using by setting the CMake variable BUILTIN_TRANSLATIONS. In this case it is also necessary to load the translations using this function.

Definition at line 123 of file resources.cpp.

## ◆ loadQtTranslationFile() [3/3]

QT_UTILITIES_EXPORT void QtUtilities::TranslationFiles::loadQtTranslationFile | ( | std::initializer_list< QString > | repositoryNames,
|  | const QString & | localeName )