summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/linguist/lconvert/main.cpp17
-rw-r--r--tools/linguist/shared/translator.h2
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; }