diff options
author | jan iversen <jani@documentfoundation.org> | 2016-03-20 11:18:06 +0100 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2016-03-22 16:32:19 +0100 |
commit | fe150b57b6c146cb174bfe066d4f6a2ba9b65760 (patch) | |
tree | f54ad472b238ce8ae12fcc171c16f1fd5666f8d1 /l10ntools/source/gLang.cxx | |
parent | 40a218baf8823d883c8d9d2839ff95780e7ff0ed (diff) |
genlang, generating .pot files for .xrm files
Solved new pot directory structure
only tested .xrm files, but should be able to extract
all .pot files.
The LO tools generated the KID as part of the msg, this
is not implemented.
msgctxt is used as comments, this requires a slight change
of the lex programs.
Change-Id: Id9aadbd419fb44b73b633410f7dddd90d310ee8d
Diffstat (limited to 'l10ntools/source/gLang.cxx')
-rw-r--r-- | l10ntools/source/gLang.cxx | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/l10ntools/source/gLang.cxx b/l10ntools/source/gLang.cxx index 1c09507fa9b1..6bcb5449b32b 100644 --- a/l10ntools/source/gLang.cxx +++ b/l10ntools/source/gLang.cxx @@ -39,7 +39,7 @@ class handler private: bool mbForceSave; - enum {DO_CONVERT, DO_EXTRACT, DO_MERGE_KID, DO_MERGE} meWorkMode; + enum {DO_CONVERT, DO_EXTRACT, DO_MERGE} meWorkMode; string msTargetDir; string msPoDir; vector<string> mvSourceFiles; @@ -49,7 +49,7 @@ class handler void loadL10MEM(bool onlyTemplates); void runConvert(); void runExtract(); - void runMerge(bool bKid); + void runMerge(); }; @@ -78,7 +78,6 @@ void handler::showUsage(string sErr) " merge merge po files back to sources\n" " <options> is a combination of\n" " -d show debug information\n" - " -k generate key identifier version\n" " -s save unconditionally\n" " -v show progress information\n" "\n" @@ -122,7 +121,7 @@ void handler::showManual() "\n\n"; cout << - " genLang merge [-v] [-d] [-s] [-k]\n" + " genLang merge [-v] [-d] [-s]\n" " --files <files>\n" " --target <directory>\n" " --po <directory>\n" @@ -177,13 +176,6 @@ void handler::checkCommandLine(int argc, char *argv[]) if (sWorkText == "-d") { // show debug information mcMemory.setDebug(true); - mcMemory.setVerbose(true); - } - else if (sWorkText == "-k") { - // generate key identifier version - if (meWorkMode != DO_MERGE) - throw "-k requires \"merge\""; - meWorkMode = DO_MERGE_KID; } else if (sWorkText == "-v") { // show progress information @@ -222,7 +214,6 @@ void handler::checkCommandLine(int argc, char *argv[]) case DO_EXTRACT: bSourceFiles = bTargetDir = true; break; - case DO_MERGE_KID: case DO_MERGE: bPoDir = bTargetDir = true; break; @@ -241,10 +232,9 @@ void handler::run() // use workMode to start correct control part switch (meWorkMode) { - case DO_EXTRACT: runExtract(); break; - case DO_MERGE: runMerge(false); break; - case DO_MERGE_KID: runMerge(true); break; - case DO_CONVERT: runConvert(); break; + case DO_EXTRACT: runExtract(); break; + case DO_MERGE: runMerge(); break; + case DO_CONVERT: runConvert(); break; } } @@ -264,7 +254,7 @@ void handler::loadL10MEM(bool onlyTemplates) // and load file mcMemory.setLanguage("", true); - convert_gen::createInstance(mcMemory, sLoad, msTargetDir, "").execute(false, false); + convert_gen::createInstance(mcMemory, sLoad, msTargetDir, "").execute(false); if (onlyTemplates) return; @@ -302,7 +292,7 @@ void handler::runConvert() // get converter and extract files convert_gen& convertObj = convert_gen::createInstance(mcMemory, "./", msTargetDir, *siSource); - convertObj.execute(false, false); + convertObj.execute(false); mcMemory.showNOconvert(); @@ -331,6 +321,7 @@ void handler::runConvert() void handler::runExtract() { vector<string>::iterator siSource; + int newPos; // no convert mcMemory.setConvert(false, false); @@ -340,9 +331,13 @@ void handler::runExtract() // tell system l10nMem::showDebug("genLang extracting text from file " + *siSource); + // set module name + newPos = (*siSource).find_last_of("/\\", (*siSource).length()); + mcMemory.setModuleName((*siSource).substr(0, newPos)); + // get converter and extract file convert_gen& convertObj = convert_gen::createInstance(mcMemory, "", msTargetDir, *siSource); - convertObj.execute(false, false); + convertObj.execute(false); } // and generate language file @@ -351,7 +346,7 @@ void handler::runExtract() -void handler::runMerge(bool bKid) +void handler::runMerge() { vector<string>::iterator siSource; @@ -365,7 +360,7 @@ void handler::runMerge(bool bKid) // get converter and extract file convert_gen& convertObj = convert_gen::createInstance(mcMemory, "", msTargetDir, *siSource); - convertObj.execute(true, bKid); + convertObj.execute(true); } } |