Skip to content

How to translate

Pier Luigi Fiorini edited this page Feb 19, 2014 · 1 revision

The Qt5LinguistTools is required because it has some handy macros, see here for more information.

You can check for this package with code like this from the main CMakeLists.txt file:

find_package(Qt5 5.2 REQUIRED COMPONENTS LinguistTools)

Of course this instruction can include more components.

Add the REFRESH_TRANSLATIONS option to the main CMakeLists.txt. Make sure you declare the option after the FeatureSummary file is included:

# Refresh translations at build time
option(REFRESH_TRANSLATIONS "Refresh translations at build time" OFF)
add_feature_info(RefreshTranslations REFRESH_TRANSLATIONS "Refresh translations at build time.")

Now create, from the source code root, a translations directory:

mkdir translations

with a structure quite similar to the src subdirectory