summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-07-26 16:46:42 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-08-08 08:56:38 +0000
commit2feb3e558573b6745f6d235efecb94ee87c54298 (patch)
treef86d4f29eed77853efec4b68a577e907b2de5cea /share
parenta96ed0d4a017047eabf85be1ccc22e9bae576338 (diff)
downloadqt-creator-2feb3e558573b6745f6d235efecb94ee87c54298.tar.gz
Qt wizards: Include translation file, if requested
Provide all wizards for Qt-based projects with the ability to set up a skeleton .ts file and add it to the generated project. Task-number: QTCREATORBUG-7453 Change-Id: I4dfb34c0101062edd0209173f83737e69063e27a Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt17
-rw-r--r--share/qtcreator/templates/wizards/projects/consoleapp/file.pro5
-rw-r--r--share/qtcreator/templates/wizards/projects/consoleapp/file.qbs7
-rw-r--r--share/qtcreator/templates/wizards/projects/consoleapp/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt13
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/project.pro5
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs3
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json12
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt26
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro5
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs3
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt13
-rw-r--r--share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro5
-rw-r--r--share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs7
-rw-r--r--share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json11
-rw-r--r--share/qtcreator/templates/wizards/projects/translation.ts3
20 files changed, 184 insertions, 6 deletions
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt
index ce63061d75..d7eda0b02d 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/CMakeLists.txt
@@ -11,7 +11,22 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+@if %{HasTranslation}
+find_package(Qt5 COMPONENTS Core LinguistTools REQUIRED)
+
+set(TS_FILES %{TsFileName})
+@else
find_package(Qt5Core)
+@endif
-add_executable(%{ProjectName} %{CppFileName})
+add_executable(%{ProjectName}
+ %{CppFileName}
+@if %{HasTranslation}
+ ${TS_FILES}
+@endif
+)
target_link_libraries(%{ProjectName} Qt5::Core)
+@if %{HasTranslation}
+
+qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/file.pro b/share/qtcreator/templates/wizards/projects/consoleapp/file.pro
index d38289ce09..a8ed27c2ad 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/file.pro
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/file.pro
@@ -16,6 +16,11 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \\
%{CppFileName}
+@if %{HasTranslation}
+
+TRANSLATIONS += \\
+ %{TsFileName}
+@endif
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs b/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs
index 3587027384..dfdd823780 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/file.qbs
@@ -17,7 +17,12 @@ QtApplication {
]
consoleApplication: true
- files: "%{CppFileName}"
+ files: [
+ "%{CppFileName}",
+@if %{HasTranslation}
+ "%{TsFileName}",
+@endif
+ ]
Group { // Properties for the produced executable
fileTagsFilter: "application"
diff --git a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
index bee602c87d..b500c9edf4 100644
--- a/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/consoleapp/wizard.json
@@ -16,6 +16,7 @@
{ "key": "ProFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}" },
{ "key": "QbsFile", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}" },
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" },
+ { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }
],
@@ -64,6 +65,11 @@
]
},
{
+ "trDisplayName": "Translation File",
+ "trShortTitle": "Translation",
+ "typeId": "QtTranslation"
+ },
+ {
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
@@ -105,6 +111,11 @@
"openInEditor": true
},
{
+ "source": "../translation.ts",
+ "target": "%{TsFileName}",
+ "condition": "%{HasTranslation}"
+ },
+ {
"source": "../git.ignore",
"target": ".gitignore",
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt
index 243280b657..b69799a442 100644
--- a/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/CMakeLists.txt
@@ -12,8 +12,14 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@if '%{QtModule}' != 'none'
+@if %{HasTranslation}
+find_package(Qt5 COMPONENTS %{QtModuleUpperCase} LinguistTools REQUIRED)
+
+set(TS_FILES %{TsFileName})
+@else
find_package(Qt5 COMPONENTS %{QtModuleUpperCase} REQUIRED)
@endif
+@endif
add_library(%{ProjectName} %{JS: %{IsStatic} ? 'STATIC' : 'SHARED'}
@if '%{Type}' === 'shared'
@@ -24,6 +30,9 @@ add_library(%{ProjectName} %{JS: %{IsStatic} ? 'STATIC' : 'SHARED'}
@if %{IsQtPlugin}
%{PluginJsonFile}
@endif
+@if %{HasTranslation}
+ ${TS_FILES}
+@endif
)
@if '%{QtModule}' != 'none'
@@ -33,3 +42,7 @@ target_link_libraries(%{ProjectName} PRIVATE Qt5::%{QtModuleUpperCase})
target_compile_definitions(%{ProjectName} PRIVATE %{LibraryDefine})
@endif
+@if %{HasTranslation}
+
+qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro
index 431667ada5..8eba894fe5 100644
--- a/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.pro
@@ -36,6 +36,11 @@ HEADERS += \\
%{GlobalHdrFileName} \\
@endif
%{HdrFileName}
+@if %{HasTranslation}
+
+TRANSLATIONS += \\
+ %{TsFileName}
+@endif
@if %{IsQtPlugin}
DISTFILES += %{PluginJsonFile}
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs b/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs
index 0e5df73e84..2c51c9e116 100644
--- a/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/project.qbs
@@ -41,6 +41,9 @@ DynamicLibrary {
@if %{IsQtPlugin}
"%{PluginJsonFile}",
@endif
+@if %{HasTranslation}
+ "%{TsFileName}",
+@endif
]
@if '%{TargetInstallPath}' != ''
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
index 8f4c264499..512ffdfe66 100644
--- a/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/wizard.json
@@ -31,6 +31,7 @@
{ "key": "TargetInstallPath", "value": "%{JS: value('IsShared') === 'true' ? '/usr/lib' : (value('IsQtPlugin') && value('PluginTargetPath') ? '$$[QT_INSTALL_PLUGINS]/' + value('PluginTargetPath') : '')}" },
{ "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" },
{ "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" },
+ { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "GLOBAL_GUARD", "value": "%{JS: Cpp.headerGuard(value('GlobalHdrFileName'))}" }
],
@@ -272,6 +273,12 @@
]
},
{
+ "trDisplayName": "Translation File",
+ "trShortTitle": "Translation",
+ "data": { "enabled": "%{JS: value('QtModule') === 'none' ? 'no' : 'yes'}" },
+ "typeId": "QtTranslation"
+ },
+ {
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
@@ -327,6 +334,11 @@
"condition": "%{JS: value('Type') === 'qtplugin'}"
},
{
+ "source": "../translation.ts",
+ "target": "%{TsFileName}",
+ "condition": "%{HasTranslation}"
+ },
+ {
"source": "../git.ignore",
"target": ".gitignore",
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
index 165a32be3d..4e5524ecc6 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
@@ -11,18 +11,40 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+@if %{HasTranslation}
+find_package(Qt5 COMPONENTS Core Quick LinguistTools REQUIRED)
+
+set(TS_FILES %{TsFileName})
+@else
find_package(Qt5 COMPONENTS Core Quick REQUIRED)
+@endif
if(ANDROID)
- add_library(%{ProjectName} SHARED %{MainCppFileName} qml.qrc)
+ add_library(%{ProjectName} SHARED
+ %{MainCppFileName}
+ qml.qrc
+@if %{HasTranslation}
+ ${TS_FILES}
+@endif
+ )
else()
- add_executable(%{ProjectName} %{MainCppFileName} qml.qrc)
+ add_executable(%{ProjectName}
+ %{MainCppFileName}
+ qml.qrc
+@if %{HasTranslation}
+ ${TS_FILES}
+@endif
+ )
endif()
target_compile_definitions(%{ProjectName}
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(%{ProjectName}
PRIVATE Qt5::Core Qt5::Quick)
+@if %{HasTranslation}
+
+qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
+@endif
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro
index 0ac5682b11..908aaa3e07 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.pro
@@ -21,6 +21,11 @@ SOURCES += \\
%{MainCppFileName}
RESOURCES += qml.qrc
+@if %{HasTranslation}
+
+TRANSLATIONS += \\
+ %{TsFileName}
+@endif
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs
index 27a8b66c3c..f06fb39824 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/app.qbs
@@ -29,6 +29,9 @@ Application {
"%{MainCppFileName}",
"main.qml",
"qml.qrc",
+@if %{HasTranslation}
+ "%{TsFileName}",
+@endif
]
Group { // Properties for the produced executable
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json
index fe284df679..412aa3f8f8 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/empty/wizard.json
@@ -22,6 +22,7 @@
{ "key": "QtQuickVirtualKeyboardImport", "value": "%{JS: value('QtVersion').QtQuickVirtualKeyboardImport}" },
{ "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" },
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" },
+ { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" }
],
@@ -170,6 +171,11 @@
]
},
{
+ "trDisplayName": "Translation File",
+ "trShortTitle": "Translation",
+ "typeId": "QtTranslation"
+ },
+ {
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
@@ -222,6 +228,11 @@
"source": "qml.qrc"
},
{
+ "source": "../../translation.ts",
+ "target": "%{TsFileName}",
+ "condition": "%{HasTranslation}"
+ },
+ {
"source": "../../git.ignore",
"target": ".gitignore",
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json
index f03b62635a..adfa7def75 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/scroll/wizard.json
@@ -24,6 +24,7 @@
{ "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" },
{ "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" },
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" },
+ { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" }
],
@@ -221,6 +222,11 @@
]
},
{
+ "trDisplayName": "Translation File",
+ "trShortTitle": "Translation",
+ "typeId": "QtTranslation"
+ },
+ {
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
@@ -277,6 +283,11 @@
"source": "qml.qrc"
},
{
+ "source": "../../translation.ts",
+ "target": "%{TsFileName}",
+ "condition": "%{HasTranslation}"
+ },
+ {
"source": "../../git.ignore",
"target": ".gitignore",
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json
index 6640901abe..a4593f8eb1 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/stack/wizard.json
@@ -24,6 +24,7 @@
{ "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" },
{ "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" },
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" },
+ { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" }
],
@@ -239,6 +240,11 @@
]
},
{
+ "trDisplayName": "Translation File",
+ "trShortTitle": "Translation",
+ "typeId": "QtTranslation"
+ },
+ {
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
@@ -307,6 +313,11 @@
"source": "qml.qrc"
},
{
+ "source": "../../translation.ts",
+ "target": "%{TsFileName}",
+ "condition": "%{HasTranslation}"
+ },
+ {
"source": "../../git.ignore",
"target": ".gitignore",
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json
index 2b6ac53030..9f47b864e1 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/swipe/wizard.json
@@ -24,6 +24,7 @@
{ "key": "QtQuickControlsStyleTheme", "value": "%{JS: value('ControlsStyle').QtQuickControlsStyleTheme}" },
{ "key": "QtQuickFeature", "value": "QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}" },
{ "key": "UseVirtualKeyboardByDefault", "value": "%{JS: value('Plugins').indexOf('Boot2Qt') >= 0 || value('Plugins').indexOf('Boot2QtQdb') >= 0}" },
+ { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "SetQPAPhysicalSize", "value": "%{UseVirtualKeyboardByDefault}" }
],
@@ -239,6 +240,11 @@
]
},
{
+ "trDisplayName": "Translation File",
+ "trShortTitle": "Translation",
+ "typeId": "QtTranslation"
+ },
+ {
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
@@ -303,6 +309,11 @@
"source": "qml.qrc"
},
{
+ "source": "../../translation.ts",
+ "target": "%{TsFileName}",
+ "condition": "%{HasTranslation}"
+ },
+ {
"source": "../../git.ignore",
"target": ".gitignore",
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
index 5fd51e9014..ea825062f4 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/CMakeLists.txt
@@ -11,7 +11,13 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+@if %{HasTranslation}
+find_package(Qt5 COMPONENTS Widgets LinguistTools REQUIRED)
+
+set(TS_FILES %{TsFileName})
+@else
find_package(Qt5 COMPONENTS Widgets REQUIRED)
+@endif
add_executable(%{ProjectName}
%{MainFileName}
@@ -20,6 +26,13 @@ add_executable(%{ProjectName}
@if %{GenerateForm}
%{FormFileName}
@endif
+@if %{HasTranslation}
+ ${TS_FILES}
+@endif
)
target_link_libraries(%{ProjectName} PRIVATE Qt5::Widgets)
+@if %{HasTranslation}
+
+qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
+@endif
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro
index a5362aa9bc..a0a237bf20 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.pro
@@ -26,6 +26,11 @@ HEADERS += \\
FORMS += \\
%{FormFileName}
@endif
+@if %{HasTranslation}
+
+TRANSLATIONS += \\
+ %{TsFileName}
+@endif
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs
index 4a54380d6b..baa6326cb8 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/project.qbs
@@ -19,9 +19,12 @@ QtApplication {
"%{MainFileName}",
"%{SrcFileName}",
"%{HdrFileName}",
- @if %{GenerateForm}
+@if %{GenerateForm}
"%{FormFileName}",
- @endif
+@endif
+@if %{HasTranslation}
+ "%{TsFileName}",
+@endif
]
install: true
diff --git a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
index 9cce84a413..971ef3f88f 100644
--- a/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
+++ b/share/qtcreator/templates/wizards/projects/qtwidgetsapplication/wizard.json
@@ -19,6 +19,7 @@
{ "key": "MainFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
{ "key": "UiHdrFileName", "value": "%{JS: (value('BuildSystem') === 'cmake' ? (Util.path(value('FormFileName')) + '/') : '') + 'ui_' + Util.completeBaseName(value('FormFileName')) + '.h'}" },
{ "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" },
+ { "key": "HasTranslation", "value": "%{JS: value('TsFileName') !== ''}" },
{ "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName')))}" }
],
@@ -140,6 +141,11 @@
]
},
{
+ "trDisplayName": "Translation File",
+ "trShortTitle": "Translation",
+ "typeId": "QtTranslation"
+ },
+ {
"trDisplayName": "Kit Selection",
"trShortTitle": "Kits",
"typeId": "Kits",
@@ -194,6 +200,11 @@
"condition": "%{GenerateForm}"
},
{
+ "source": "../translation.ts",
+ "target": "%{TsFileName}",
+ "condition": "%{HasTranslation}"
+ },
+ {
"source": "../git.ignore",
"target": ".gitignore",
"condition": "%{JS: !value('IsSubproject') && value('VersionControl') === 'G.Git'}"
diff --git a/share/qtcreator/templates/wizards/projects/translation.ts b/share/qtcreator/templates/wizards/projects/translation.ts
new file mode 100644
index 0000000000..ed21a4017e
--- /dev/null
+++ b/share/qtcreator/templates/wizards/projects/translation.ts
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="%{TsLanguage}"></TS>