summaryrefslogtreecommitdiffstats
path: root/tools/linguist/lconvert/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/linguist/lconvert/main.cpp')
-rw-r--r--tools/linguist/lconvert/main.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/linguist/lconvert/main.cpp b/tools/linguist/lconvert/main.cpp
index 534bc11..1381595 100644
--- a/tools/linguist/lconvert/main.cpp
+++ b/tools/linguist/lconvert/main.cpp
@@ -81,10 +81,13 @@ static int usage(const QStringList &args)
" --output-format <outformat>\n"
" Specify output format. See -if.\n\n"
" --input-codec <codec>\n"
- " Specify encoding for .qm input files. Default is 'Latin1'.\n"
- " UTF-8 is always tried as well, corresponding to the trUtf8() function.\n\n"
+ " Specify encoding for QM and PO input files. Default is 'Latin1'\n"
+ " for QM and 'UTF-8' for PO files. UTF-8 is always tried as well for\n"
+ " QM, corresponding to the possible use of the trUtf8() function.\n\n"
+ " --output-codec <codec>\n"
+ " Specify encoding for PO output files. Default is 'UTF-8'.\n\n"
" --drop-tags <regexp>\n"
- " Drop named extra tags when writing 'ts' or 'xlf' files.\n"
+ " Drop named extra tags when writing TS or XLIFF files.\n"
" May be specified repeatedly.\n\n"
" --drop-translations\n"
" Drop existing translations and reset the status to 'unfinished'.\n"
@@ -101,10 +104,10 @@ static int usage(const QStringList &args)
" --no-finished\n"
" Drop finished messages.\n\n"
" --locations {absolute|relative|none}\n"
- " Override how source code references are saved in ts files.\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"
+ " Drop line numbers from references to UI files.\n\n"
" --verbose\n"
" be a bit more verbose\n\n"
"Long options can be specified with only one leading dash, too.\n\n"
@@ -141,7 +144,6 @@ int main(int argc, char *argv[])
Translator::LocationsType locations = Translator::DefaultLocations;
ConversionData cd;
- cd.m_codecForSource = "Latin1";
Translator tr;
for (int i = 1; i < args.size(); ++i) {
@@ -174,6 +176,10 @@ int main(int argc, char *argv[])
if (++i >= args.size())
return usage(args);
cd.m_codecForSource = args[i].toLatin1();
+ } else if (args[i] == QLatin1String("-output-codec")) {
+ if (++i >= args.size())
+ return usage(args);
+ cd.m_outputCodec = args[i].toLatin1();
} else if (args[i] == QLatin1String("-drop-tag")) {
if (++i >= args.size())
return usage(args);
@@ -257,6 +263,11 @@ int main(int argc, char *argv[])
if (locations != Translator::DefaultLocations)
tr.setLocationsType(locations);
+ tr.normalizeTranslations(cd);
+ if (!cd.errors().isEmpty()) {
+ qWarning("%s", qPrintable(cd.error()));
+ cd.clearErrors();
+ }
if (!tr.save(outFileName, cd, outFormat)) {
qWarning("%s", qPrintable(cd.error()));
return 3;