summaryrefslogtreecommitdiffstats
path: root/tools/linguist
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-10-06 14:56:16 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-10-06 17:19:57 (GMT)
commit3b3788a25f58fc443a48672c8e852e1c8658ac4e (patch)
treee1bac1da1d9f5ced4d82094dff7ac5a59597a0b6 /tools/linguist
parent3b51392d6ab6cc3a1760ca2c795261e185bd344a (diff)
downloadQt-3b3788a25f58fc443a48672c8e852e1c8658ac4e.zip
Qt-3b3788a25f58fc443a48672c8e852e1c8658ac4e.tar.gz
Qt-3b3788a25f58fc443a48672c8e852e1c8658ac4e.tar.bz2
add -list-languages option to lupdate
Diffstat (limited to 'tools/linguist')
-rw-r--r--tools/linguist/lupdate/main.cpp3
-rw-r--r--tools/linguist/shared/numerus.cpp23
-rw-r--r--tools/linguist/shared/translator.h2
3 files changed, 28 insertions, 0 deletions
diff --git a/tools/linguist/lupdate/main.cpp b/tools/linguist/lupdate/main.cpp
index ab88083..7337732 100644
--- a/tools/linguist/lupdate/main.cpp
+++ b/tools/linguist/lupdate/main.cpp
@@ -508,6 +508,9 @@ int main(int argc, char **argv)
|| arg == QLatin1String("-h")) {
printUsage();
return 0;
+ } else if (arg == QLatin1String("-list-languages")) {
+ printOut(getNumerusInfoString());
+ return 0;
} else if (arg == QLatin1String("-pluralonly")) {
options |= PluralOnly;
continue;
diff --git a/tools/linguist/shared/numerus.cpp b/tools/linguist/shared/numerus.cpp
index 87f3aee..1ab300c 100644
--- a/tools/linguist/shared/numerus.cpp
+++ b/tools/linguist/shared/numerus.cpp
@@ -394,4 +394,27 @@ bool getNumerusInfo(QLocale::Language language, QLocale::Country country,
return false;
}
+QString getNumerusInfoString()
+{
+ QStringList langs;
+
+ for (int i = 0; i < NumerusTableSize; ++i) {
+ const NumerusTableEntry &entry = numerusTable[i];
+ for (int j = 0; entry.languages[j] != EOL; ++j) {
+ QLocale loc(entry.languages[j], entry.countries ? entry.countries[j] : QLocale::AnyCountry);
+ QString lang = QLocale::languageToString(entry.languages[j]);
+ if (loc.language() == QLocale::C)
+ lang += QLatin1String(" (!!!)");
+ else if (entry.countries && entry.countries[j] != QLocale::AnyCountry)
+ lang += QLatin1String(" (") + QLocale::countryToString(loc.country()) + QLatin1Char(')');
+ else
+ lang += QLatin1String(" [") + QLocale::countryToString(loc.country()) + QLatin1Char(']');
+ langs << QString::fromLatin1("%1 %2 %3\n").arg(lang, -40).arg(loc.name(), -8)
+ .arg(QString::fromLatin1(entry.gettextRules));
+ }
+ }
+ langs.sort();
+ return langs.join(QString());
+}
+
QT_END_NAMESPACE
diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h
index 3b7bd64..d0da527 100644
--- a/tools/linguist/shared/translator.h
+++ b/tools/linguist/shared/translator.h
@@ -254,6 +254,8 @@ private:
bool getNumerusInfo(QLocale::Language language, QLocale::Country country,
QByteArray *rules, QStringList *forms, const char **gettextRules);
+QString getNumerusInfoString();
+
bool saveQM(const Translator &translator, QIODevice &dev, ConversionData &cd);
/*