本文整理汇总了C++中Translator::dropTranslations方法的典型用法代码示例。如果您正苦于以下问题:C++ Translator::dropTranslations方法的具体用法?C++ Translator::dropTranslations怎么用?C++ Translator::dropTranslations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translator
的用法示例。
在下文中一共展示了Translator::dropTranslations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
#ifndef Q_OS_WIN32
QTranslator translator;
QTranslator qtTranslator;
QString sysLocale = QLocale::system().name();
QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)
&& qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir)) {
app.installTranslator(&translator);
app.installTranslator(&qtTranslator);
}
#endif // Q_OS_WIN32
QStringList args = app.arguments();
QList<File> inFiles;
QString inFormat(QLatin1String("auto"));
QString outFileName;
QString outFormat(QLatin1String("auto"));
QString targetLanguage;
QString sourceLanguage;
bool dropTranslations = false;
bool noObsolete = false;
bool noFinished = false;
bool verbose = false;
bool noUiLines = false;
Translator::LocationsType locations = Translator::DefaultLocations;
ConversionData cd;
Translator tr;
for (int i = 1; i < args.size(); ++i) {
if (args[i].startsWith(QLatin1String("--")))
args[i].remove(0, 1);
if (args[i] == QLatin1String("-o")
|| args[i] == QLatin1String("-output-file")) {
if (++i >= args.size())
return usage(args);
outFileName = args[i];
} else if (args[i] == QLatin1String("-of")
|| args[i] == QLatin1String("-output-format")) {
if (++i >= args.size())
return usage(args);
outFormat = args[i];
} else if (args[i] == QLatin1String("-i")
|| args[i] == QLatin1String("-input-file")) {
if (++i >= args.size())
return usage(args);
File file;
file.name = args[i];
file.format = inFormat;
inFiles.append(file);
} else if (args[i] == QLatin1String("-if")
|| args[i] == QLatin1String("-input-format")) {
if (++i >= args.size())
return usage(args);
inFormat = args[i];
} else if (args[i] == QLatin1String("-input-codec")) {
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);
cd.m_dropTags.append(args[i]);
} else if (args[i] == QLatin1String("-drop-translations")) {
dropTranslations = true;
} else if (args[i] == QLatin1String("-target-language")) {
if (++i >= args.size())
return usage(args);
targetLanguage = args[i];
} else if (args[i] == QLatin1String("-source-language")) {
if (++i >= args.size())
return usage(args);
sourceLanguage = args[i];
} else if (args[i].startsWith(QLatin1String("-h"))) {
usage(args);
return 0;
} else if (args[i] == QLatin1String("-no-obsolete")) {
noObsolete = true;
} else if (args[i] == QLatin1String("-no-finished")) {
noFinished = true;
} else if (args[i] == QLatin1String("-sort-contexts")) {
cd.m_sortContexts = 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);
//.........这里部分代码省略.........