Commit 2c414f21 authored by Sergey Belyashov's avatar Sergey Belyashov Committed by Oswald Buddenhagen
Browse files

Added possibility to translate file types in open/save dialogs.



Merge-request: 900
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@nokia.com>
parent 6f6fafe1
let $files := ( $$MIMETYPES_FILES )
let $prefix := string(\"QT_TRANSLATE_NOOP(&quot;MimeType&quot;, &quot;\")
let $suffix := concat(\"&quot;)\", codepoints-to-string(10))
for $file in $files
for $comment in doc($file)/*:mime-info/*:mime-type/*:comment
return fn:concat($prefix, data($comment), $suffix)
......@@ -8,13 +8,25 @@ defineReplace(prependAll) {
return($$result)
}
XMLPATTERNS = $$targetPath($$[QT_INSTALL_BINS]/xmlpatterns)
LUPDATE = $$targetPath($$[QT_INSTALL_BINS]/lupdate) -locations relative -no-ui-lines
LRELEASE = $$targetPath($$[QT_INSTALL_BINS]/lrelease)
TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts)
contains(QT_VERSION, ^4\.[0-5]\..*):ts.commands = @echo This Qt version is too old for the ts target. Need Qt 4.6+.
else:ts.commands = (cd $$IDE_SOURCE_TREE && $$LUPDATE src -ts $$TRANSLATIONS)
MIME_TR_H = $$IDE_DATA_PATH/translations/mime_tr.h
contains(QT_VERSION, ^4\.[0-5]\..*) {
ts.commands = @echo This Qt version is too old for the ts target. Need Qt 4.6+.
} else {
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, \", \")\"
QMAKE_SUBSTITUTES += extract-mimetypes.xq.in
ts.commands += \
$$XMLPATTERNS -output $$MIME_TR_H $$PWD/extract-mimetypes.xq && \
(cd $$IDE_SOURCE_TREE && $$LUPDATE src $$MIME_TR_H -ts $$TRANSLATIONS) && \
$$QMAKE_DEL_FILE $$MIME_TR_H
}
QMAKE_EXTRA_TARGETS += ts
TEMPLATE = app
......
......@@ -717,7 +717,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
case ParseComment: {
// comments have locale attributes. We want the default, English one
QString locale = reader.attributes().value(QLatin1String(localeAttributeC)).toString();
const QString comment = reader.readElementText();
const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toAscii());
if (locale.isEmpty()) {
data.comment = comment;
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment