diff options
author | con <qtc-committer@nokia.com> | 2010-07-26 12:26:05 +0200 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2010-07-26 12:26:05 +0200 |
commit | 39a8e977759f3810ff367e2d8390d913791af3e3 (patch) | |
tree | 12d7f7c446d9c3c1de0d605684ef05d3ae0b1667 /share | |
parent | 91b6d329fe74143c75ccd53b1e6a2a129c113a7a (diff) | |
parent | 1a985148340ff3b29c752036857446452cf0907f (diff) |
Merge commit origin/2.0 '1a985148340ff3b29c752036857446452cf0907f'
Conflicts:
src/plugins/qmldesigner/settingspage.ui
src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.cpp
src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp
Diffstat (limited to 'share')
-rwxr-xr-x | share/qtcreator/translations/check-ts.pl | 87 | ||||
-rw-r--r-- | share/qtcreator/translations/check-ts.xq | 3 | ||||
-rw-r--r-- | share/qtcreator/translations/extract-customwizards.xq (renamed from share/qtcreator/translations/extract-customwizards.xq.in) | 9 | ||||
-rw-r--r-- | share/qtcreator/translations/extract-mimetypes.xq | 5 | ||||
-rw-r--r-- | share/qtcreator/translations/extract-mimetypes.xq.in | 6 | ||||
-rw-r--r-- | share/qtcreator/translations/translations.pro | 57 |
6 files changed, 145 insertions, 22 deletions
diff --git a/share/qtcreator/translations/check-ts.pl b/share/qtcreator/translations/check-ts.pl new file mode 100755 index 00000000000..02909f25129 --- /dev/null +++ b/share/qtcreator/translations/check-ts.pl @@ -0,0 +1,87 @@ +#! /usr/bin/perl -w +############################################################################# +## +## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +## All rights reserved. +## Contact: Nokia Corporation (qt-info@nokia.com) +## +## This file is part of the translations module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:LGPL$ +## No Commercial Usage +## This file contains pre-release code and may not be distributed. +## You may use this file in accordance with the terms and conditions +## contained in the Technology Preview License Agreement accompanying +## this package. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 2.1 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 2.1 requirements +## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +## +## In addition, as a special exception, Nokia gives you certain additional +## rights. These rights are described in the Nokia Qt LGPL Exception +## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +## +## If you have questions regarding the use of this file, please contact +## Nokia at qt-info@nokia.com. +## +## +## +## +## +## +## +## +## $QT_END_LICENSE$ +## +############################################################################# + + +use strict; + +my %scores = (); + +my $files = join("\n", <*_??.ts>); +my $res = `xmlpatterns -param files=\"$files\" check-ts.xq`; +for my $i (split(/ /, $res)) { + $i =~ /^(?:[^\/]+\/)*qtcreator_(..)\.ts:(.*)$/; + my ($lang, $pc) = ($1, $2); + $scores{$lang} = $pc; +} + +my $code = ""; + +for my $lang (sort(keys(%scores))) { + my $pc = $scores{$lang}; + my $fail = ""; + if (int($pc) < 98) { + $fail = " (excluded)"; + } else { + $code .= " ".$lang; + } + printf "%-5s %3d%s\n", $lang, $pc, $fail; +} + +my $fn = "translations.pro"; +my $nfn = $fn."new"; +open IN, $fn or die; +open OUT, ">".$nfn or die; +while (1) { + $_ = <IN>; + last if (/^LANGUAGES /); + print OUT $_; +} +while ($_ =~ /\\\n$/) { + $_ = <IN>; +} +print OUT "LANGUAGES =".$code."\n"; +while (<IN>) { + print OUT $_; +} +close OUT; +close IN; +rename $nfn, $fn; diff --git a/share/qtcreator/translations/check-ts.xq b/share/qtcreator/translations/check-ts.xq new file mode 100644 index 00000000000..2d6404cefc7 --- /dev/null +++ b/share/qtcreator/translations/check-ts.xq @@ -0,0 +1,3 @@ +for $file in tokenize($files, codepoints-to-string(10)) + let $fresh := doc($file)/TS/context/message[not (translation/@type = 'obsolete')] + return concat($file, ":", count($fresh/translation[not (@type = 'unfinished')]) * 100 idiv count($fresh)) diff --git a/share/qtcreator/translations/extract-customwizards.xq.in b/share/qtcreator/translations/extract-customwizards.xq index 28e2e2d131b..55adeacfe5f 100644 --- a/share/qtcreator/translations/extract-customwizards.xq.in +++ b/share/qtcreator/translations/extract-customwizards.xq @@ -1,9 +1,6 @@ -let $files := ( $$CUSTOMWIZARD_FILES ) -let $prefix := string(\"QT_TRANSLATE_NOOP("ProjectExplorer::CustomWizard", "\") -let $suffix := concat(\"")\", codepoints-to-string(10)) -where empty($files) -return -for $file in $files +let $prefix := string("QT_TRANSLATE_NOOP("ProjectExplorer::CustomWizard", "") +let $suffix := concat("")", codepoints-to-string(10)) +for $file in tokenize($files, string("\|")) let $doc := doc($file) for $text in ($doc/*:wizard/*:description, $doc/*:wizard/*:displayname, $doc/*:wizard/*:displaycategory, $doc/*:wizard/*:fieldpagetitle, $doc/*:wizard/*:fields/*:field/*:fielddescription, $doc/*:wizard/*:fields/*:field/*:fieldcontrol/*:comboentries/*:comboentry/*:comboentrytext) return fn:concat($prefix, data($text), $suffix) diff --git a/share/qtcreator/translations/extract-mimetypes.xq b/share/qtcreator/translations/extract-mimetypes.xq new file mode 100644 index 00000000000..181d99d4991 --- /dev/null +++ b/share/qtcreator/translations/extract-mimetypes.xq @@ -0,0 +1,5 @@ +let $prefix := string("QT_TRANSLATE_NOOP("MimeType", "") +let $suffix := concat("")", codepoints-to-string(10)) +for $file in tokenize($files, string("\|")) + for $comment in doc($file)/*:mime-info/*:mime-type/*:comment + return fn:concat($prefix, data($comment), $suffix) diff --git a/share/qtcreator/translations/extract-mimetypes.xq.in b/share/qtcreator/translations/extract-mimetypes.xq.in deleted file mode 100644 index 8a4bb835f7d..00000000000 --- a/share/qtcreator/translations/extract-mimetypes.xq.in +++ /dev/null @@ -1,6 +0,0 @@ -let $files := ( $$MIMETYPES_FILES ) -let $prefix := string(\"QT_TRANSLATE_NOOP("MimeType", "\") -let $suffix := concat(\"")\", 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) diff --git a/share/qtcreator/translations/translations.pro b/share/qtcreator/translations/translations.pro index 831a8511704..ae4bd5c1bd5 100644 --- a/share/qtcreator/translations/translations.pro +++ b/share/qtcreator/translations/translations.pro @@ -12,6 +12,7 @@ defineReplace(prependAll) { XMLPATTERNS = $$targetPath($$[QT_INSTALL_BINS]/xmlpatterns) LUPDATE = $$targetPath($$[QT_INSTALL_BINS]/lupdate) -locations relative -no-ui-lines -no-sort LRELEASE = $$targetPath($$[QT_INSTALL_BINS]/lrelease) +LCONVERT = $$targetPath($$[QT_INSTALL_BINS]/lconvert) TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts) @@ -19,18 +20,54 @@ MIME_TR_H = $$OUT_PWD/mime_tr.h CUSTOMWIZARD_TR_H = $$OUT_PWD/customwizard_tr.h for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml) -MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, \", \")\" +MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, |)\" for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml) -CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, \", \")\" - -QMAKE_SUBSTITUTES += extract-mimetypes.xq.in -QMAKE_SUBSTITUTES += extract-customwizards.xq.in -ts.commands += \ - $$XMLPATTERNS -output $$MIME_TR_H $$PWD/extract-mimetypes.xq && \ - $$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H $$PWD/extract-customwizards.xq && \ - (cd $$IDE_SOURCE_TREE && $$LUPDATE src share/qtcreator/qmldesigner $$MIME_TR_H $$CUSTOMWIZARD_TR_H -ts $$TRANSLATIONS) && \ - $$QMAKE_DEL_FILE $$MIME_TR_H +CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, |)\" + +extract.commands += \ + $$XMLPATTERNS -output $$MIME_TR_H -param files=$$MIMETYPES_FILES $$PWD/extract-mimetypes.xq $$escape_expand(\\n\\t) \ + $$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H -param files=$$CUSTOMWIZARD_FILES $$PWD/extract-customwizards.xq +QMAKE_EXTRA_TARGETS += extract + +files = $$files($$PWD/*_??.ts) $$PWD/qtcreator_untranslated.ts +for(file, files) { + lang = $$replace(file, .*_(.*)\\.ts, \\1) + v = ts-$${lang}.commands + $$v = cd $$IDE_SOURCE_TREE && $$LUPDATE src share/qtcreator/qmldesigner $$MIME_TR_H $$CUSTOMWIZARD_TR_H -ts $$file + v = ts-$${lang}.depends + $$v = extract + QMAKE_EXTRA_TARGETS += ts-$$lang +} +ts-all.commands = cd $$IDE_SOURCE_TREE && $$LUPDATE src share/qtcreator/qmldesigner $$MIME_TR_H $$CUSTOMWIZARD_TR_H -ts $$files +ts-all.depends = extract +QMAKE_EXTRA_TARGETS += ts-all + +check-ts.commands = (cd $$PWD && perl check-ts.pl) +check-ts.depends = ts-all +QMAKE_EXTRA_TARGETS += check-ts + +isEqual(QMAKE_DIR_SEP, /) { + commit-ts.commands = \ + cd $$IDE_SOURCE_TREE; \ + for f in `git diff-files --name-only share/qtcreator/translations/*_??.ts`; do \ + $$LCONVERT -locations none -i \$\$f -o \$\$f; \ + done; \ + git add share/qtcreator/translations/*_??.ts && git commit +} else { + wd = $$replace(IDE_SOURCE_TREE, /, \\) + commit-ts.commands = \ + cd $$wd && \ + for /f usebackq %%f in (`git diff-files --name-only share/qtcreator/translations/*_??.ts`) do \ + $$LCONVERT -locations none -i %%f -o %%f $$escape_expand(\\n\\t) \ + cd $$wd && git add share/qtcreator/translations/*_??.ts && git commit +} +QMAKE_EXTRA_TARGETS += commit-ts + +ts.commands = \ + @echo \"The \'ts\' target has been removed in favor of more fine-grained targets.\" && \ + echo \"Use \'ts-<lang>\' instead. To add a language, use \'ts-untranslated\',\" && \ + echo \"rename the file and re-run \'qmake\'.\" QMAKE_EXTRA_TARGETS += ts TEMPLATE = app |