Skip to content
Snippets Groups Projects
Commit 04509bcf authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Custom wizards: Lower case all tags, prepare translations.

Prepare translations of wizards shipped by Nokia to be searched
in Qt Creator's qm-files.
parent 609163c1
No related branches found
No related tags found
No related merge requests found
...@@ -39,11 +39,8 @@ leave room for the Qt 4 target page. ...@@ -39,11 +39,8 @@ leave room for the Qt 4 target page.
id="A.HelloWorld" category="B.CustomProjects"> id="A.HelloWorld" category="B.CustomProjects">
<icon>console.png</icon> <icon>console.png</icon>
<description>Creates a hello-world-project with custom message.</description> <description>Creates a hello-world-project with custom message.</description>
<description xml:lang="de">Erzeugt ein Hello-Welt-Projekt mit einer Nachricht.</description> <displayname>Hello World</displayname>;
<displayName>Hello World</displayName>; <displaycategory>Custom Projects</displaycategory>
<displayName xml:lang="de">Hallo Welt</displayName>;
<displayCategory>Custom Projects</displayCategory>
<displayCategory xml:lang="de">Benutzerdefinierte Projekte</displayCategory>
<files> <files>
<file source="main.cpp"/> <file source="main.cpp"/>
<file source="project.pro" target="%ProjectName%.pro"/> <file source="project.pro" target="%ProjectName%.pro"/>
......
...@@ -33,10 +33,10 @@ Custom class wizard example configuration file. --> ...@@ -33,10 +33,10 @@ Custom class wizard example configuration file. -->
<wizard version="1" kind="class" id="A.ListModel" category="B.CustomClasses"> <wizard version="1" kind="class" id="A.ListModel" category="B.CustomClasses">
<description>Creates a QAbstractListModel implementation.</description> <description>Creates a QAbstractListModel implementation.</description>
<description xml:lang="de">Erzeugt eine Implementierung von QAbstractListModel.</description> <description xml:lang="de">Erzeugt eine Implementierung von QAbstractListModel.</description>
<displayName>QAbstractListModel implementation</displayName>; <displayname>QAbstractListModel implementation</displayname>;
<displayName xml:lang="de">Implementierung von QAbstractListModel</displayName>; <displayname xml:lang="de">Implementierung von QAbstractListModel</displayname>;
<displayCategory>Custom Classes</displayCategory> <displaycategory>Custom Classes</displaycategory>
<displayCategory xml:lang="de">Benutzerdefinierte Klassen</displayCategory> <displaycategory xml:lang="de">Benutzerdefinierte Klassen</displaycategory>
<files> <files>
<file source="listmodel.cpp" target="%ClassName:l%.%CppSourceSuffix%"/> <file source="listmodel.cpp" target="%ClassName:l%.%CppSourceSuffix%"/>
<file source="listmodel.h" target="%ClassName:l%.%CppHeaderSuffix%"/> <file source="listmodel.h" target="%ClassName:l%.%CppHeaderSuffix%"/>
......
...@@ -38,8 +38,8 @@ leave room for the Qt 4 target page. ...@@ -38,8 +38,8 @@ leave room for the Qt 4 target page.
class="qt4project" firstpage="10" class="qt4project" firstpage="10"
id="QmlRuntimePlugin" category="F.Projects"> id="QmlRuntimePlugin" category="F.Projects">
<description>Creates a plug-in for the QML runtime.</description> <description>Creates a plug-in for the QML runtime.</description>
<displayName>QML Runtime Plug-in</displayName> <displayname>QML Runtime Plug-in</displayname>
<displayCategory>QML Runtime Plug-in</displayCategory> <displaycategory>QML Runtime Plug-in</displaycategory>
<files> <files>
<file source="qmldir" target="%ProjectName%/qmldir"/> <file source="qmldir" target="%ProjectName%/qmldir"/>
<file source="plugin.h" target="%ProjectName%.h"/> <file source="plugin.h" target="%ProjectName%.h"/>
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <cpptools/cpptoolsconstants.h> #include <cpptools/cpptoolsconstants.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QCoreApplication>
#include <QtCore/QLocale> #include <QtCore/QLocale>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
...@@ -46,14 +47,14 @@ enum { debug = 0 }; ...@@ -46,14 +47,14 @@ enum { debug = 0 };
static const char customWizardElementC[] = "wizard"; static const char customWizardElementC[] = "wizard";
static const char iconElementC[] = "icon"; static const char iconElementC[] = "icon";
static const char descriptionElementC[] = "description"; static const char descriptionElementC[] = "description";
static const char displayNameElementC[] = "displayName"; static const char displayNameElementC[] = "displayname";
static const char idAttributeC[] = "id"; static const char idAttributeC[] = "id";
static const char kindAttributeC[] = "kind"; static const char kindAttributeC[] = "kind";
static const char klassAttributeC[] = "class"; static const char klassAttributeC[] = "class";
static const char firstPageAttributeC[] = "firstpage"; static const char firstPageAttributeC[] = "firstpage";
static const char langAttributeC[] = "xml:lang"; static const char langAttributeC[] = "xml:lang";
static const char categoryAttributeC[] = "category"; static const char categoryAttributeC[] = "category";
static const char displayCategoryElementC[] = "displayCategory"; static const char displayCategoryElementC[] = "displaycategory";
static const char fieldPageTitleElementC[] = "fieldpagetitle"; static const char fieldPageTitleElementC[] = "fieldpagetitle";
static const char fieldsElementC[] = "fields"; static const char fieldsElementC[] = "fields";
static const char fieldElementC[] = "field"; static const char fieldElementC[] = "field";
...@@ -144,7 +145,10 @@ static inline void assignLanguageElementText(QXmlStreamReader &reader, ...@@ -144,7 +145,10 @@ static inline void assignLanguageElementText(QXmlStreamReader &reader,
QString *target) QString *target)
{ {
const QStringRef elementLanguage = reader.attributes().value(langAttributeC); const QStringRef elementLanguage = reader.attributes().value(langAttributeC);
if (elementLanguage.isEmpty() || elementLanguage == desiredLanguage) { if (elementLanguage.isEmpty()) {
// Try to find a translation for our built-in Wizards
*target = QCoreApplication::translate("ProjectExplorer::CustomWizard", reader.readElementText().toLatin1().constData());
} else if (elementLanguage == desiredLanguage) {
*target = reader.readElementText(); *target = reader.readElementText();
} else { } else {
// Language mismatch: forward to end element. // Language mismatch: forward to end element.
...@@ -161,7 +165,11 @@ static inline void assignLanguageElementText(QXmlStreamReader &reader, ...@@ -161,7 +165,11 @@ static inline void assignLanguageElementText(QXmlStreamReader &reader,
void (Core::BaseFileWizardParameters::*setter)(const QString &)) void (Core::BaseFileWizardParameters::*setter)(const QString &))
{ {
const QStringRef elementLanguage = reader.attributes().value(langAttributeC); const QStringRef elementLanguage = reader.attributes().value(langAttributeC);
if (elementLanguage.isEmpty() || elementLanguage == desiredLanguage) { if (elementLanguage.isEmpty()) {
// Try to find a translation for our built-in Wizards
const QString translated = QCoreApplication::translate("ProjectExplorer::CustomWizard", reader.readElementText().toLatin1().constData());
(bp->*setter)(translated);
} else if (elementLanguage == desiredLanguage) {
(bp->*setter)(reader.readElementText()); (bp->*setter)(reader.readElementText());
} else { } else {
// Language mismatch: forward to end element. // Language mismatch: forward to end element.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment