diff options
Diffstat (limited to 'l10ntools/source')
-rw-r--r-- | l10ntools/source/gConvPo.cxx | 16 | ||||
-rw-r--r-- | l10ntools/source/gConvProp.cxx | 13 | ||||
-rw-r--r-- | l10ntools/source/gConvSrc.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/gConvTree.cxx | 6 | ||||
-rw-r--r-- | l10ntools/source/gConvUlf.cxx | 12 | ||||
-rw-r--r-- | l10ntools/source/gConvXcs.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/gConvXcu.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/gConvXhp.cxx | 4 | ||||
-rw-r--r-- | l10ntools/source/gConvXrm.cxx | 9 | ||||
-rw-r--r-- | l10ntools/source/gL10nMem.cxx | 84 | ||||
-rw-r--r-- | l10ntools/source/gLang.cxx | 2 | ||||
-rw-r--r-- | l10ntools/source/gLexUlf.l | 4 |
12 files changed, 60 insertions, 114 deletions
diff --git a/l10ntools/source/gConvPo.cxx b/l10ntools/source/gConvPo.cxx index 3b588e2adf60..e3adbbf2d1da 100644 --- a/l10ntools/source/gConvPo.cxx +++ b/l10ntools/source/gConvPo.cxx @@ -40,12 +40,6 @@ convert_po::convert_po(l10nMem& crMemory) -convert_po::~convert_po() -{ -} - - - void convert_po::startLook() { string sFileName, sNewKey; @@ -62,7 +56,7 @@ void convert_po::startLook() // load in db if (msId.size()) - mcMemory.loadEntryKey(miLineNo, sFileName, sNewKey, msId, msStr, mbFuzzy); + mcMemory.loadEntryKey(miLineNo, sFileName, sNewKey, msId, msStr, "", "", mbFuzzy); // and prepare for new entry msKey.clear(); @@ -188,6 +182,7 @@ void convert_po::save(const string& sFileName, const string& sKey, const string& sENUStext, const string& sText, + const string& sComment, const string& sResource, bool bFuzzy) { @@ -199,9 +194,10 @@ void convert_po::save(const string& sFileName, newPos = sFileName.find_last_of("/\\", sFileName.length()); sName = sFileName.substr(newPos + 1, sFileName.length()); - outFile << endl - << "#. xxxxx" << endl - << "#: " << sName << endl + outFile << endl << "#. xxxxx" << endl; + if (sComment.length()) + outFile << "#. " << sComment << endl; + outFile << "#: " << sName << endl << "msgctxt \"\"" << endl << "\"" << sName << "\\n\"" << endl << "\"" << sKey << "\\n\"" << endl diff --git a/l10ntools/source/gConvProp.cxx b/l10ntools/source/gConvProp.cxx index b473c6d51998..a7067676a4a5 100644 --- a/l10ntools/source/gConvProp.cxx +++ b/l10ntools/source/gConvProp.cxx @@ -25,19 +25,6 @@ using namespace std; -convert_prop::convert_prop(l10nMem& crMemory) : convert_gen(crMemory) -{ - // throw l10nMem::showError(string("convert_prop not implemented")); -} - - - -convert_prop::~convert_prop() -{ -} - - - void convert_prop::doExecute() { throw l10nMem::showError(string("convert_prop::execute not implemented")); diff --git a/l10ntools/source/gConvSrc.cxx b/l10ntools/source/gConvSrc.cxx index a6dbe2f9b087..d73bd4d137c6 100644 --- a/l10ntools/source/gConvSrc.cxx +++ b/l10ntools/source/gConvSrc.cxx @@ -39,9 +39,9 @@ convert_src::convert_src(l10nMem& crMemory) mbValuePresent(false), mbInList(false), mbInListItem(false) -{} -convert_src::~convert_src() -{} +{ +} + extern int srclex(void); @@ -176,7 +176,7 @@ void convert_src::setNL(char *syyText, bool bMacro) sKey += "." + msCmd + "." + msTextName; if (msValue.size() && msValue != "-") { - mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, msValue, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, msValue, "", "", mbMergeMode); if (mbMergeMode) insertLanguagePart(sKey, msTextName); } diff --git a/l10ntools/source/gConvTree.cxx b/l10ntools/source/gConvTree.cxx index b582da5f76d7..2d2075f4c524 100644 --- a/l10ntools/source/gConvTree.cxx +++ b/l10ntools/source/gConvTree.cxx @@ -106,7 +106,7 @@ void convert_tree::setString(char *yytext) case STATE_VAL_TITLE: string sText = copySourceSpecial(yytext, 1); sText.erase(sText.size()-1); - mcMemory.setSourceKey(miLineNo, msSourceFile, msId, sText, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, msId, sText, "", "", mbMergeMode); break; } meStateVal = STATE_VAL_NONE; @@ -121,14 +121,14 @@ void convert_tree::setState(char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNew meStateTag = eNewStateTag; meStateVal = eNewStateVAL; if (sModule) - mcMemory.setResourceName(sModule); + msModule = sModule; } void convert_tree::setValue(char *yytext) { - mcMemory.setSourceKey(miLineNo, msSourceFile, msId, msCollector, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, msId, msCollector, "", msModule, mbMergeMode); copySourceSpecial(yytext, 2); meStateTag = STATE_TAG_NONE; diff --git a/l10ntools/source/gConvUlf.cxx b/l10ntools/source/gConvUlf.cxx index 424396eb322c..556d0e4aefa4 100644 --- a/l10ntools/source/gConvUlf.cxx +++ b/l10ntools/source/gConvUlf.cxx @@ -25,10 +25,6 @@ using namespace std; -convert_ulf::convert_ulf(l10nMem& crMemory) : convert_gen(crMemory) {} -convert_ulf::~convert_ulf() {} - - extern int ulflex(void); void convert_ulf::doExecute() { @@ -49,11 +45,11 @@ void convert_ulf::setKey(char *syyText) void convert_ulf::setText(char *syyText, bool bIsEnUs) { - string sText = copySource(syyText) + " is not en-US"; + string sText = copySource(syyText); - if (!bIsEnUs) - l10nMem::showError(sText); + if (!bIsEnUs && sText != "x-comment =") + l10nMem::showError(sText + " is not en-US"); } @@ -67,7 +63,7 @@ void convert_ulf::setValue(char *syyText) nL = sText.rfind("\""); sText.erase(nL); - mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "", mbMergeMode); if (mbMergeMode) { // prepare to read all languages diff --git a/l10ntools/source/gConvXcs.cxx b/l10ntools/source/gConvXcs.cxx index 1753b792154b..dc8a4a63d136 100644 --- a/l10ntools/source/gConvXcs.cxx +++ b/l10ntools/source/gConvXcs.cxx @@ -33,12 +33,6 @@ convert_xcs::convert_xcs(l10nMem& crMemory) -convert_xcs::~convert_xcs() -{ -} - - - extern int xcslex(void); void convert_xcs::doExecute() { @@ -130,6 +124,6 @@ void convert_xcs::stopCollectData(char *syyText) #endif } - mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, sText, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, sText, "", "", mbMergeMode); mbCollectingData = false; } diff --git a/l10ntools/source/gConvXcu.cxx b/l10ntools/source/gConvXcu.cxx index ddb2b0297e81..87a9927bd0d6 100644 --- a/l10ntools/source/gConvXcu.cxx +++ b/l10ntools/source/gConvXcu.cxx @@ -32,12 +32,6 @@ convert_xcu::convert_xcu(l10nMem& crMemory) -convert_xcu::~convert_xcu() -{ -} - - - extern int xculex(void); void convert_xcu::doExecute() { @@ -129,7 +123,7 @@ void convert_xcu::stopCollectData(char *syyText) // locate key and extract it for (nL = 0; nL < (int)mcStack.size(); ++nL) useKey += (useKey.size() ? "." : "" ) + mcStack[nL]; - mcMemory.setSourceKey(miLineNo, msSourceFile, useKey, useText, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, useKey, useText, "", "", mbMergeMode); } if (mbMergeMode) { diff --git a/l10ntools/source/gConvXhp.cxx b/l10ntools/source/gConvXhp.cxx index f12422c1ed3d..db19ba1df531 100644 --- a/l10ntools/source/gConvXhp.cxx +++ b/l10ntools/source/gConvXhp.cxx @@ -54,8 +54,6 @@ void convert_xhp::doExecute() string sLang; string sFile, sFile2; - mcMemory.setResourceName("help"); - // prepare list with languages miCntLanguages = mcMemory.prepareMerge(); if (mbMergeMode) { @@ -251,7 +249,7 @@ void convert_xhp::closeTransTag(char *yytext) string newString(msCollector); if (newString[newString.length() - 1] == ' ') newString = newString.substr(0, newString.length() - 1); - mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, newString, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, newString, "", "help", mbMergeMode); } msKey.clear(); iType = 2; diff --git a/l10ntools/source/gConvXrm.cxx b/l10ntools/source/gConvXrm.cxx index 23316ce40805..2a075feed843 100644 --- a/l10ntools/source/gConvXrm.cxx +++ b/l10ntools/source/gConvXrm.cxx @@ -35,16 +35,9 @@ convert_xrm::convert_xrm(l10nMem& crMemory) -convert_xrm::~convert_xrm() -{ -} - - - extern int xrmlex(void); void convert_xrm::doExecute() { - mcMemory.setResourceName("readmeitem"); xrmlex(); // write last part of file. @@ -124,7 +117,7 @@ void convert_xrm::stopCollectData(char *yytext) copySource(yytext); if (!mbNoCollectingData) { - mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, mbMergeMode); + mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "readmeitem", mbMergeMode); mbNoCollectingData = true; if (mbMergeMode) { sTagEnd = "</" + msTag.substr(1,msTag.size()-2) + ">\n"; diff --git a/l10ntools/source/gL10nMem.cxx b/l10ntools/source/gL10nMem.cxx index 46471a7877fe..fb50ac96985a 100644 --- a/l10ntools/source/gL10nMem.cxx +++ b/l10ntools/source/gL10nMem.cxx @@ -89,13 +89,15 @@ class l10nMem_enus_entry public: l10nMem_enus_entry(const string& sKey, const string& sMsgId, + const string& sComment, const string& sResource, int iLineNo, int iFileInx, int iLangSize, l10nMem::ENTRY_STATE eState) : msMsgId(sMsgId), - msResId(sResource), + msComment(sComment), + msResource(sResource), meState(eState), miFileInx(iFileInx), miLineNo(iLineNo) @@ -115,10 +117,11 @@ class l10nMem_enus_entry string msKey; // key in po file and source file string msMsgId; // en-US text from source file - string msResId; // Resource Id (to be used in msgcstr) - l10nMem::ENTRY_STATE meState; // status information - int miFileInx; // index of file name - int miLineNo; // line number + string msComment; // Comment (to be used in msgcstr) + string msResource; // Resource Id (to be used in msgcstr) + l10nMem::ENTRY_STATE meState; // status information + int miFileInx; // index of file name + int miLineNo; // line number vector<l10nMem_lang_entry> mcLangText; // language texts (index is languageId) }; @@ -137,10 +140,9 @@ l10nMem::l10nMem() { myMem = this; msModuleName = "default"; - msResourceName = ""; mcFileList.push_back(l10nMem_file_entry("-genLang-", 0)); mcLangList.push_back(l10nMem_lang_list_entry("-genLang-")); - mcENUSlist.push_back(l10nMem_enus_entry("-genLang-", "-genLang-", "", 0, 0, 0, l10nMem::ENTRY_DELETED)); + mcENUSlist.push_back(l10nMem_enus_entry("-genLang-", "-genLang-", "", "", 0, 0, 0, l10nMem::ENTRY_DELETED)); } @@ -204,20 +206,6 @@ const string& l10nMem::getModuleName() -void l10nMem::setResourceName(const string& sResourceName) -{ - msResourceName = sResourceName; -} - - - -const string& l10nMem::getResourceName() -{ - return msResourceName; -} - - - void l10nMem::setLanguage(const string& sLanguage, bool bCreate) { @@ -284,28 +272,32 @@ void l10nMem::setDebug(bool doDebug) -void l10nMem::loadEntryKey(int iLineNo, +void l10nMem::loadEntryKey(int iLineNo, const string& sSourceFile, const string& sKey, const string& sMsgId, const string& sMsgStr, - bool bIsFuzzy) + const string& sComment, + const string& sResource, + bool bIsFuzzy) { if (mbConvertMode) convEntryKey(iLineNo, sSourceFile, sKey, sMsgId, sMsgStr, bIsFuzzy); else if (!miCurLangInx) - loadENUSkey(iLineNo, sSourceFile, sKey, sMsgId); + loadENUSkey(iLineNo, sSourceFile, sKey, sMsgId, sComment, sResource); else loadLangKey(iLineNo, sSourceFile, sKey, sMsgId, sMsgStr, bIsFuzzy); } -void l10nMem::setSourceKey(int iLineNo, +void l10nMem::setSourceKey(int iLineNo, const string& sSourceFile, const string& sKey, const string& sMsgId, - bool bMustExist) + const string& sComment, + const string& sResource, + bool bMustExist) { string newText(sMsgId); int i; @@ -336,21 +328,17 @@ void l10nMem::setSourceKey(int iLineNo, throw showError("key " + sKey + " does not exist"); // add key, if changed text, this is wrong but handled in reorganize - addKey(iLineNo, sSourceFile, sKey, newText, ENTRY_ADDED); + addKey(iLineNo, sSourceFile, sKey, newText, sComment, sResource, ENTRY_ADDED); } } -void l10nMem::saveTemplates(const string& sTargetDir, bool bKid, bool bForce) +void l10nMem::saveTemplates(const string& sTargetDir, bool bForce) { string target(msModuleName + ".pot"); int iE, iEsize = mcENUSlist.size(); - // Dummy to satisfy compiler - if (bKid) - throw "-k not implemented"; - // and reorganize db if needed miCurFileInx = 0; reorganize(false); @@ -359,8 +347,6 @@ void l10nMem::saveTemplates(const string& sTargetDir, bool bKid, bool bForce) if (!needWrite(target, bForce)) return; - //JIX save HANDLE KID - // Save en-US convert_po savePo(*this); @@ -372,7 +358,7 @@ void l10nMem::saveTemplates(const string& sTargetDir, bool bKid, bool bForce) if (cE.meState == ENTRY_DELETED) continue; - savePo.save(mcFileList[cE.miFileInx].msFileName, cE.msKey, cE.msMsgId, "", cE.msResId, false); + savePo.save(mcFileList[cE.miFileInx].msFileName, cE.msKey, cE.msMsgId, "", cE.msComment, cE.msResource, false); } savePo.endSave(); } @@ -679,12 +665,12 @@ bool l10nMem::convFilterWarning(const string& sSourceFile, -void l10nMem::convEntryKey(int iLineNo, +void l10nMem::convEntryKey(int iLineNo, const string& sSourceFile, const string& sKey, const string& sMsgId, const string& sMsgStr, - bool bIsFuzzy) + bool bIsFuzzy) { vector<int> ivEntryList; string curFileName; @@ -774,23 +760,25 @@ void l10nMem::convEntryKey(int iLineNo, -void l10nMem::loadENUSkey(int iLineNo, - const string& sSourceFile, - const string& sKey, - const string& sMsgId) +void l10nMem::loadENUSkey(int iLineNo, + const string& sSourceFile, + const string& sKey, + const string& sMsgId, + const string& sComment, + const string& sResource) { // add it to vector and update file pointer - addKey(iLineNo, sSourceFile, sKey, sMsgId, ENTRY_DELETED); + addKey(iLineNo, sSourceFile, sKey, sMsgId, sComment, sResource, ENTRY_DELETED); } -void l10nMem::loadLangKey(int iLineNo, +void l10nMem::loadLangKey(int iLineNo, const string& sSourceFile, const string& sKey, const string& sMsgId, const string& sMsgStr, - bool bFuzzy) + bool bFuzzy) { if (!locateKey(iLineNo, sSourceFile, sKey, sMsgId, true)) throw l10nMem::showError(".po file contains unknown filename: " + sSourceFile + " or key: " + sKey); @@ -901,10 +889,12 @@ bool l10nMem::locateKey(int iLineNo, -void l10nMem::addKey(int iLineNo, +void l10nMem::addKey(int iLineNo, const string& sSourceFile, const string& sKey, const string& sMsgId, + const string& sComment, + const string& sResource, l10nMem::ENTRY_STATE eStat) { // check file @@ -917,7 +907,7 @@ void l10nMem::addKey(int iLineNo, mcFileList.push_back(l10nMem_file_entry(sSourceFile, miCurENUSinx)); // and add entry at the back (no problem since it is a new file) - mcENUSlist.push_back(l10nMem_enus_entry(sKey, sMsgId, msResourceName, iLineNo, miCurFileInx, + mcENUSlist.push_back(l10nMem_enus_entry(sKey, sMsgId, sComment, sResource, iLineNo, miCurFileInx, mcLangList.size(), eStat)); mcFileList[miCurFileInx].miEnd = miCurENUSinx; } @@ -930,7 +920,7 @@ void l10nMem::addKey(int iLineNo, curF.miEnd++; miCurENUSinx = curF.miEnd; mcENUSlist.insert(it + curF.miEnd, - l10nMem_enus_entry(sKey, sMsgId, msResourceName, iLineNo, miCurFileInx, + l10nMem_enus_entry(sKey, sMsgId, sComment, sResource, iLineNo, miCurFileInx, mcLangList.size(), eStat)); for (int i = miCurFileInx + 1; i < iFsize; ++i) { l10nMem_file_entry& curF2 = mcFileList[i]; diff --git a/l10ntools/source/gLang.cxx b/l10ntools/source/gLang.cxx index 6bcb5449b32b..c3e93f37125c 100644 --- a/l10ntools/source/gLang.cxx +++ b/l10ntools/source/gLang.cxx @@ -341,7 +341,7 @@ void handler::runExtract() } // and generate language file - mcMemory.saveTemplates(msTargetDir, false, mbForceSave); + mcMemory.saveTemplates(msTargetDir, mbForceSave); } diff --git a/l10ntools/source/gLexUlf.l b/l10ntools/source/gLexUlf.l index f6409ec359ee..c0dcf157352f 100644 --- a/l10ntools/source/gLexUlf.l +++ b/l10ntools/source/gLexUlf.l @@ -131,7 +131,5 @@ KEYID [a-zA-Z0-9_-]+ void ulf_dummyJustForCompiler() { - char *txt = NULL; - // yy_flex_strlen(txt); - yyunput(0, txt); + yyunput(0, NULL); } |