diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-05-25 17:58:02 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-05-25 18:00:48 (GMT) |
commit | afcd5b98b1855390e1c5c1308f0beff256391d96 (patch) | |
tree | 287dcbcb6a6776555f384248d7760fb40cca5dc7 /tools/linguist | |
parent | ef4c47d8b4dc9b2056541cd29686b0959fd778a4 (diff) | |
download | Qt-afcd5b98b1855390e1c5c1308f0beff256391d96.zip Qt-afcd5b98b1855390e1c5c1308f0beff256391d96.tar.gz Qt-afcd5b98b1855390e1c5c1308f0beff256391d96.tar.bz2 |
implement --locations option (complementing lupdate)
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/lconvert/main.cpp | 17 | ||||
-rw-r--r-- | tools/linguist/shared/translator.h | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp index 52bf91f..ce17b6f 100644 --- a/tools/linguist/lconvert/main.cpp +++ b/tools/linguist/lconvert/main.cpp @@ -97,6 +97,9 @@ static int usage(const QStringList &args) " Drop obsolete messages.\n\n" " --no-finished\n" " Drop finished messages.\n\n" + " --locations {absolute|relative|none}\n" + " Override how source code references are saved in ts files.\n" + " Default is absolute.\n}n" " --no-ui-lines\n" " Drop line numbers from references to .ui files.\n\n" " --verbose\n" @@ -132,6 +135,7 @@ int main(int argc, char *argv[]) bool noFinished = false; bool verbose = false; bool noUiLines = false; + Translator::LocationsType locations = Translator::DefaultLocations; ConversionData cd; Translator tr; @@ -183,6 +187,17 @@ int main(int argc, char *argv[]) noObsolete = true; } else if (args[i] == QLatin1String("-no-finished")) { noFinished = true; + } else if (args[i] == QLatin1String("-locations")) { + if (++i >= args.size()) + return usage(args); + if (args[i] == QLatin1String("none")) + locations = Translator::NoLocations; + else if (args[i] == QLatin1String("relative")) + locations = Translator::RelativeLocations; + else if (args[i] == QLatin1String("absolute")) + locations = Translator::AbsoluteLocations; + else + return usage(args); } else if (args[i] == QLatin1String("-no-ui-lines")) { noUiLines = true; } else if (args[i] == QLatin1String("-verbose")) { @@ -231,6 +246,8 @@ int main(int argc, char *argv[]) tr.dropTranslations(); if (noUiLines) tr.dropUiLines(); + if (locations != Translator::DefaultLocations) + tr.setLocationsType(locations); if (!tr.save(outFileName, cd, outFormat)) { qWarning("%s", qPrintable(cd.error())); diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index 3dda41a..5d0549b 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -144,7 +144,7 @@ public: QString languageCode() const { return m_language; } QString sourceLanguageCode() const { return m_sourceLanguage; } - enum LocationsType { NoLocations, RelativeLocations, AbsoluteLocations }; + enum LocationsType { DefaultLocations, NoLocations, RelativeLocations, AbsoluteLocations }; void setLocationsType(LocationsType lt) { m_locationsType = lt; } LocationsType locationsType() const { return m_locationsType; } |