Qt Utilities 6.14.0
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 80 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 280 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
applicationNameSpecifies the name of the application.
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 176 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
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:
    • ./
    • ../$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 223 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
applicationNamesSpecifies the names of the applications.

Definition at line 257 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
applicationNamesSpecifies the names of the applications.
localeNameSpecifies the name of the locale.

Definition at line 270 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
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 120 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
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 100 of file resources.cpp.

◆ loadQtTranslationFile() [3/3]

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