summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorjan iversen <jani@documentfoundation.org>2016-03-21 13:38:42 +0100
committerjan iversen <jani@documentfoundation.org>2016-03-22 16:32:19 +0100
commit0d0598fc8f7fffe90b9e14b3825f98770ce1affa (patch)
treeb12f805d0048dde5a993ec84d3618574bc6782f5 /l10ntools
parent3ec0b7ed0d2028517afaee5c3ffa0b9f04a68bd2 (diff)
genlang, PO files contain both comment and resource extra
the .ulf ==> .pot keep the x-comment, therefore the memory db is expanded with sResource and sComment. The memory db API is changed to add the 2 new fields, which causes a change in all callers. Change-Id: I38527c8d2db9d56ecf9ae42550ed5420371b658e
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/inc/gConvPo.hxx3
-rw-r--r--l10ntools/inc/gConvProp.hxx4
-rw-r--r--l10ntools/inc/gConvSrc.hxx2
-rw-r--r--l10ntools/inc/gConvTree.hxx23
-rw-r--r--l10ntools/inc/gConvUlf.hxx4
-rw-r--r--l10ntools/inc/gConvXcs.hxx2
-rw-r--r--l10ntools/inc/gConvXcu.hxx2
-rw-r--r--l10ntools/inc/gConvXrm.hxx2
-rw-r--r--l10ntools/inc/gL10nMem.hxx84
-rw-r--r--l10ntools/source/gConvPo.cxx16
-rw-r--r--l10ntools/source/gConvProp.cxx13
-rw-r--r--l10ntools/source/gConvSrc.cxx8
-rw-r--r--l10ntools/source/gConvTree.cxx6
-rw-r--r--l10ntools/source/gConvUlf.cxx12
-rw-r--r--l10ntools/source/gConvXcs.cxx8
-rw-r--r--l10ntools/source/gConvXcu.cxx8
-rw-r--r--l10ntools/source/gConvXhp.cxx4
-rw-r--r--l10ntools/source/gConvXrm.cxx9
-rw-r--r--l10ntools/source/gL10nMem.cxx84
-rw-r--r--l10ntools/source/gLang.cxx2
-rw-r--r--l10ntools/source/gLexUlf.l4
21 files changed, 124 insertions, 176 deletions
diff --git a/l10ntools/inc/gConvPo.hxx b/l10ntools/inc/gConvPo.hxx
index abab7fd8fda2..69c62d025922 100644
--- a/l10ntools/inc/gConvPo.hxx
+++ b/l10ntools/inc/gConvPo.hxx
@@ -31,7 +31,7 @@ class convert_po : public convert_gen
convert_po(l10nMem& crMemory);
- ~convert_po();
+ ~convert_po() {};
void startLook ();
void setValue (char *syyText, int iLineCnt);
@@ -49,6 +49,7 @@ class convert_po : public convert_gen
const string& sKey,
const string& sENUStext,
const string& sText,
+ const string& sComment,
const string& sResource,
bool bFuzzy);
void endSave();
diff --git a/l10ntools/inc/gConvProp.hxx b/l10ntools/inc/gConvProp.hxx
index 819e92597cc9..b9e5b7c7a30f 100644
--- a/l10ntools/inc/gConvProp.hxx
+++ b/l10ntools/inc/gConvProp.hxx
@@ -25,8 +25,8 @@
class convert_prop : public convert_gen
{
public:
- convert_prop(l10nMem& crMemory);
- ~convert_prop();
+ convert_prop(l10nMem& crMemory) : convert_gen(crMemory) {};
+ ~convert_prop() {};
private:
void doExecute() override;
diff --git a/l10ntools/inc/gConvSrc.hxx b/l10ntools/inc/gConvSrc.hxx
index 21fa0f497c98..dd41895b4483 100644
--- a/l10ntools/inc/gConvSrc.hxx
+++ b/l10ntools/inc/gConvSrc.hxx
@@ -28,7 +28,7 @@ class convert_src : public convert_gen
bool mbExpectValue;
convert_src(l10nMem& crMemory);
- ~convert_src();
+ ~convert_src() {};
void setValue (char *syyText, char *sbuildValue);
void setLang (char *syyText, bool bEnUs);
diff --git a/l10ntools/inc/gConvTree.hxx b/l10ntools/inc/gConvTree.hxx
index 90ee86037a50..fff9248d836b 100644
--- a/l10ntools/inc/gConvTree.hxx
+++ b/l10ntools/inc/gConvTree.hxx
@@ -42,20 +42,21 @@ class convert_tree : public convert_gen
convert_tree(l10nMem& crMemory);
~convert_tree();
- void setString (char *yytext);
- void setState (char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNewStateVAL, char *sModule);
- void setValue (char *yytext);
- string& copySourceSpecial (char *yytext, int iType);
- void writeSourceFile (string& sText, int inx);
+ void setString(char *yytext);
+ void setState(char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNewStateVAL, char *sModule);
+ void setValue(char *yytext);
+ void writeSourceFile(string& sText, int inx);
+ string& copySourceSpecial(char *yytext, int iType);
private:
- string msLine;
- string msId;
- string msAppl;
+ string msLine;
+ string msModule;
+ string msId;
+ string msAppl;
ofstream *mcOutputFiles;
- STATE_TAG meStateTag;
- STATE_VAL meStateVal;
- int miCntLanguages;
+ STATE_TAG meStateTag;
+ STATE_VAL meStateVal;
+ int miCntLanguages;
void doExecute() override;
};
diff --git a/l10ntools/inc/gConvUlf.hxx b/l10ntools/inc/gConvUlf.hxx
index 52d415da2613..7053059d1888 100644
--- a/l10ntools/inc/gConvUlf.hxx
+++ b/l10ntools/inc/gConvUlf.hxx
@@ -25,8 +25,8 @@
class convert_ulf : public convert_gen
{
public:
- convert_ulf(l10nMem& crMemory);
- ~convert_ulf();
+ convert_ulf(l10nMem& crMemory) : convert_gen(crMemory) {};
+ ~convert_ulf() {};
void setKey(char *syyText);
void setText(char *syyText, bool bIsEnUs);
diff --git a/l10ntools/inc/gConvXcs.hxx b/l10ntools/inc/gConvXcs.hxx
index 2d65cc3d2dff..c7bedede084a 100644
--- a/l10ntools/inc/gConvXcs.hxx
+++ b/l10ntools/inc/gConvXcs.hxx
@@ -26,7 +26,7 @@ class convert_xcs : public convert_gen
{
public:
convert_xcs(l10nMem& crMemory);
- ~convert_xcs();
+ ~convert_xcs() {};
void setKey(char *syyText);
void unsetKey(char *syyText);
diff --git a/l10ntools/inc/gConvXcu.hxx b/l10ntools/inc/gConvXcu.hxx
index b00b9ba431ce..c222eaca2c43 100644
--- a/l10ntools/inc/gConvXcu.hxx
+++ b/l10ntools/inc/gConvXcu.hxx
@@ -29,7 +29,7 @@ class convert_xcu : public convert_gen
bool mbNoCollectingData;
convert_xcu(l10nMem& crMemory);
- ~convert_xcu();
+ ~convert_xcu() {};
void pushKey(char *syyText);
void popKey(char *syyText);
diff --git a/l10ntools/inc/gConvXrm.hxx b/l10ntools/inc/gConvXrm.hxx
index 4187a848f5e6..60b063f64762 100644
--- a/l10ntools/inc/gConvXrm.hxx
+++ b/l10ntools/inc/gConvXrm.hxx
@@ -27,7 +27,7 @@ class convert_xrm : public convert_gen
public:
bool mbNoCollectingData;
convert_xrm(l10nMem& crMemory);
- ~convert_xrm();
+ ~convert_xrm() {};
void setId(char *yytext);
void setLang(char *yytext);
diff --git a/l10ntools/inc/gL10nMem.hxx b/l10ntools/inc/gL10nMem.hxx
index 141b080047b8..635f4fb64702 100644
--- a/l10ntools/inc/gL10nMem.hxx
+++ b/l10ntools/inc/gL10nMem.hxx
@@ -35,41 +35,42 @@ class l10nMem
ENTRY_NORMAL
} ENTRY_STATE;
- static int showError(const string& sText, int iLineNo = 0);
+ static int showError (const string& sText, int iLineNo = 0);
static void showWarning(const string& sText, int iLineNo = 0);
- static void showDebug(const string& sText, int iLineNo = 0);
+ static void showDebug (const string& sText, int iLineNo = 0);
static void showVerbose(const string& sText, int iLineNo = 0);
- static void keyToUpper(string& sKey);
+ static void keyToUpper (string& sKey);
void setModuleName(const string& sModuleName);
const string& getModuleName(void);
- void setResourceName(const string& sResourceName);
- const string& getResourceName(void);
void setLanguage(const string& sLanguage,
- bool bCreate);
- void setConvert(bool bConvert,
- bool bStrict);
+ bool bCreate);
+ void setConvert(bool bConvert,
+ bool bStrict);
void setVerbose(const bool doVerbose);
void setDebug(const bool doDebug);
- void loadEntryKey(int iLineNo,
+ void loadEntryKey(int iLineNo,
const string& sSourceFile,
const string& sKey,
const string& sOrgText,
const string& sText,
- bool bIsFuzzy);
- void setSourceKey(int iLineNo,
+ const string& sComment,
+ const string& sResource,
+ bool bIsFuzzy);
+ void setSourceKey(int iLineNo,
const string& sFilename,
const string& sKey,
const string& sText,
- bool bMustExist);
+ const string& sComment,
+ const string& sResource,
+ bool bMustExist);
void saveTemplates(const string& sTargetDir,
- bool bKid,
- bool bForce);
- void saveLanguages(l10nMem& cMem,
+ bool bForce);
+ void saveLanguages(l10nMem& cMem,
const string& sTargetDir,
- bool bForce);
+ bool bForce);
void dumpMem(const string& sTargetDir);
int prepareMerge();
bool getMergeLang(string& sLang,
@@ -80,17 +81,16 @@ class l10nMem
void convertFromInetString(string& sText);
private:
- bool mbVerbose;
- bool mbDebug;
- bool mbInError;
+ bool mbVerbose;
+ bool mbDebug;
+ bool mbInError;
string msModuleName;
- string msResourceName;
- int miCurFileInx;
- int miCurLangInx;
- int miCurENUSinx;
- bool mbNeedWrite;
- bool mbConvertMode;
- bool mbStrictMode;
+ int miCurFileInx;
+ int miCurLangInx;
+ int miCurENUSinx;
+ bool mbNeedWrite;
+ bool mbConvertMode;
+ bool mbStrictMode;
vector<l10nMem_enus_entry> mcENUSlist;
vector<l10nMem_file_entry> mcFileList;
vector<l10nMem_lang_list_entry> mcLangList;
@@ -105,31 +105,31 @@ class l10nMem
const string& sKey,
const string& sMsgId,
const string& sMsgStr,
- bool bIsFuzzy);
- void saveTemplates(l10nMem& cMem,
- const string& sTargetDir,
- bool bKid,
- bool bForce);
- void loadENUSkey(int iLineNo,
+ bool bIsFuzzy);
+ void loadENUSkey(int iLineNo,
const string& sSourceFile,
const string& sKey,
- const string& sMsgId);
- void loadLangKey(int iLineNo,
+ const string& sMsgId,
+ const string& sComment,
+ const string& sResource);
+ void loadLangKey(int iLineNo,
const string& sSourceFile,
const string& sKey,
const string& sMsgId,
const string& sMsgStr,
- bool bFuzzy);
- void reorganize(bool bConvert);
- bool locateKey(int iLineNo,
+ bool bFuzzy);
+ void reorganize(bool bConvert);
+ bool locateKey(int iLineNo,
const string& sSourceFile,
const string& sKey,
const string& sMsgId,
- bool bThrow);
- void addKey(int iLineNo,
- const string& sSourceFile,
- const string& sKey,
- const string& sMsgId,
+ bool bThrow);
+ void addKey(int iLineNo,
+ const string& sSourceFile,
+ const string& sKey,
+ const string& sMsgId,
+ const string& sComment,
+ const string& sResource,
l10nMem::ENTRY_STATE eStat);
bool findFileName(const string& sSourceFile);
};
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);
}