Qt Utilities  5.11.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Functions
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. More...
 
QT_UTILITIES_EXPORT void loadQtTranslationFile (std::initializer_list< QString > repositoryNames)
 Loads and installs the appropriate Qt translation file for the current locale. More...
 
QT_UTILITIES_EXPORT void loadQtTranslationFile (std::initializer_list< QString > repositoryNames, const QString &localeName)
 
QT_UTILITIES_EXPORT void loadApplicationTranslationFile (const QString &applicationName)
 Loads and installs the appropriate application translation file for the current locale. More...
 
QT_UTILITIES_EXPORT void loadApplicationTranslationFile (const QString &applicationName, const QString &localeName)
 Loads and installs the appropriate application translation file for the specified locale. More...
 
QT_UTILITIES_EXPORT void loadApplicationTranslationFile (const std::initializer_list< QString > &applicationNames)
 Loads and installs the appropriate application translation file for the current locale. More...
 
QT_UTILITIES_EXPORT void loadApplicationTranslationFile (const std::initializer_list< QString > &applicationNames, const QString &localeName)
 Loads and installs the appropriate application translation file for the specified locale. More...
 
void loadQtTranslationFile (initializer_list< QString > repositoryNames, const QString &localeName)
 Loads and installs the appropriate Qt translation file for the specified locale. More...
 

Detailed Description

Convenience functions to load translations for Qt and the application.

Function Documentation

◆ additionalTranslationFilePath()

QString & TranslationFiles::additionalTranslationFilePath ( )

Allows to set an additional search path for translation files.

Remarks
This path is considered before the default directories.

Definition at line 73 of file resources.cpp.

◆ loadApplicationTranslationFile() [1/4]

void TranslationFiles::loadApplicationTranslationFile ( const QString &  applicationName)

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

Parameters
applicationNameSpecifies the name of the application.
Remarks
  • Translation files have to be placed in one of the following locations:
    • ./translations
    • /usr/share/$application/translations (used in UNIX)
    • ../share/$application/translations (used in Windows)
  • 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 154 of file resources.cpp.

◆ loadApplicationTranslationFile() [2/4]

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

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

Parameters
applicationNameSpecifies the name of the application.
localeNameSpecifies the name of the locale.
Remarks
  • Translation files have to be placed in one of the following locations:
    • ./translations
    • /usr/share/$application/translations (used in UNIX)
    • ../share/$application/translations (used in Windows)
  • 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 181 of file resources.cpp.

◆ loadApplicationTranslationFile() [3/4]

void TranslationFiles::loadApplicationTranslationFile ( const std::initializer_list< QString > &  applicationNames)

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

Parameters
applicationNamesSpecifies the names of the applications.

Definition at line 213 of file resources.cpp.

◆ loadApplicationTranslationFile() [4/4]

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

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

Parameters
applicationNamesSpecifies the names of the applications.
localeNameSpecifies the name of the locale.

Definition at line 226 of file resources.cpp.

◆ loadQtTranslationFile() [1/3]

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

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

Parameters
repositoryNamesSpecifies the names of the Qt repositories to load translations for (eg. qtbase, qtscript, ...).
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 93 of file resources.cpp.

◆ loadQtTranslationFile() [2/3]

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

◆ loadQtTranslationFile() [3/3]

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

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

Parameters
repositoryNamesSpecifies the names of the Qt repositories to load translations for (eg. qtbase, qtscript, ...).
localeNameSpecifies 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 113 of file resources.cpp.