summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000g@gmail.com>2012-11-25 14:22:24 +0100
committerZolnai Tamás <zolnaitamas2000g@gmail.com>2012-11-25 15:01:12 +0100
commitd02dc1da4a3cff852b4f29bef2fb8ce88140ef7b (patch)
tree93e0682e6cddb2b4b3b42d8cbae17a86e9204683 /l10ntools
parentb19be5c73cadfa398f6f40e74ec23b9f79a9e3b7 (diff)
Some cosmetics in l10ntools
Add comment to new classes Delete unneeded getLanguage() method Make inline GenPoEntry's setter methods Fix some typo Change-Id: I8f337b8c57e1eab7696415dc7297c64e2436f35d
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/inc/po.hxx24
-rw-r--r--l10ntools/inc/propmerge.hxx5
-rw-r--r--l10ntools/inc/treemerge.hxx6
-rw-r--r--l10ntools/source/po.cxx85
4 files changed, 61 insertions, 59 deletions
diff --git a/l10ntools/inc/po.hxx b/l10ntools/inc/po.hxx
index 856c7bb04ff1..ace9e09e3643 100644
--- a/l10ntools/inc/po.hxx
+++ b/l10ntools/inc/po.hxx
@@ -18,6 +18,16 @@ class PoOfstream;
class PoIfstream;
class GenPoEntry;
+
+/** Interface to use po entries in localization
+
+ PoEntry based on GenPoEntry class which stores attributes
+ of general po entry(see po.cxx). It makes easy to get/set
+ all information needed to localize one english(US) string.
+ It contains some basic checkings and some string
+ transformations between po string and string used by
+ localization tools.
+*/
class PoEntry
{
private:
@@ -61,6 +71,12 @@ public:
};
+/** Interface to work with header of po/pot files
+
+ This class stores informations which are in header of
+ a po file. It's main function to generate header to
+ template po files(pot).
+*/
class PoHeader: private boost::noncopyable
{
private:
@@ -73,16 +89,14 @@ public:
friend class PoOfstream;
friend class PoIfstream;
- enum Exception { NOLANG };
-
PoHeader();
PoHeader( const OString& rExtSrc );
PoHeader( std::ifstream& rOldPo );
~PoHeader();
-
- OString getLanguage() const;
};
+/** Interface to write po entry to files as output streams
+*/
class PoOfstream: private boost::noncopyable
{
private:
@@ -101,6 +115,8 @@ public:
void writeEntry(const PoEntry& rPo);
};
+/** Interface to read po entry from files as input streams
+*/
class PoIfstream: private boost::noncopyable
{
private:
diff --git a/l10ntools/inc/propmerge.hxx b/l10ntools/inc/propmerge.hxx
index 4f0e3275a434..a44649cfb91b 100644
--- a/l10ntools/inc/propmerge.hxx
+++ b/l10ntools/inc/propmerge.hxx
@@ -13,6 +13,11 @@
#include <rtl/string.hxx>
#include <vector>
+/** Class for properties localization
+
+ Parse *.properties files, extract translatable strings
+ and merge translated strings.
+*/
class PropParser
{
private:
diff --git a/l10ntools/inc/treemerge.hxx b/l10ntools/inc/treemerge.hxx
index 3b681126bfab..98f5a0218c1a 100644
--- a/l10ntools/inc/treemerge.hxx
+++ b/l10ntools/inc/treemerge.hxx
@@ -14,6 +14,12 @@
#include <rtl/string.hxx>
#include <vector>
+/** Class for tree localization
+
+ Parse *.tree files, extract translatable strings,
+ merge translated strings and update reference and title
+ of referred help files.
+*/
class TreeParser
{
private:
diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx
index 8ee7dc9c388d..d767db3cb9b5 100644
--- a/l10ntools/source/po.cxx
+++ b/l10ntools/source/po.cxx
@@ -26,8 +26,11 @@
using namespace U_ICU_NAMESPACE;
-//Class GenPoEntry
+/** Container of po entry
+ Provide all file operations related to LibreOffice specific
+ po entry and store it's attributes.
+*/
class GenPoEntry
{
private:
@@ -54,12 +57,30 @@ public:
virtual bool isFuzzy() const { return m_bFuzzy; }
virtual bool isNull() const { return m_bNull; }
- virtual void setExtractCom(const OString& rExtractCom);
- virtual void setReference(const OString& rReference);
- virtual void setMsgCtxt(const OString& rMsgCtxt);
- virtual void setMsgId(const OString& rMsgId);
- virtual void setMsgStr(const OString& rMsgStr);
- virtual void setFuzzy(const bool bFuzzy);
+ virtual void setExtractCom(const OString& rExtractCom)
+ {
+ m_sExtractCom = rExtractCom;
+ }
+ virtual void setReference(const OString& rReference)
+ {
+ m_sReference = rReference;
+ }
+ virtual void setMsgCtxt(const OString& rMsgCtxt)
+ {
+ m_sMsgCtxt = rMsgCtxt;
+ }
+ virtual void setMsgId(const OString& rMsgId)
+ {
+ m_sMsgId = rMsgId;
+ }
+ virtual void setMsgStr(const OString& rMsgStr)
+ {
+ m_sMsgStr = rMsgStr;
+ }
+ virtual void setFuzzy(const bool bFuzzy)
+ {
+ m_bFuzzy = bFuzzy;
+ }
virtual void writeToFile(std::ofstream& rOFStream) const;
virtual void readFromFile(std::ifstream& rIFStream);
@@ -151,37 +172,6 @@ GenPoEntry::~GenPoEntry()
{
}
-//Set class members
-void GenPoEntry::setExtractCom(const OString& rExtractCom)
-{
- m_sExtractCom = rExtractCom;
-}
-
-void GenPoEntry::setReference(const OString& rReference)
-{
- m_sReference = rReference;
-}
-
-void GenPoEntry::setMsgCtxt(const OString& rMsgCtxt)
-{
- m_sMsgCtxt = rMsgCtxt;
-}
-
-void GenPoEntry::setMsgId(const OString& rMsgId)
-{
- m_sMsgId = rMsgId;
-}
-
-void GenPoEntry::setMsgStr(const OString& rMsgStr)
-{
- m_sMsgStr = rMsgStr;
-}
-
-void GenPoEntry::setFuzzy(const bool bFuzzy)
-{
- m_bFuzzy = bFuzzy;
-}
-
//Write to file
void GenPoEntry::writeToFile(std::ofstream& rOFStream) const
{
@@ -274,7 +264,7 @@ namespace
boost::crc_32_type aCRC32;
aCRC32.process_bytes(rGenerator.getStr(), rGenerator.getLength());
sal_uInt32 nCRC = aCRC32.checksum();
- //Use all readable ASCII charachter exclude xml special tags: ",',&,<,>
+ //Use all readable ASCII character exclude xml special tags: ",',&,<,>
const OString sSymbols = "!#$%()*+,-./0123456789:;=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
char sKeyId[5];
for( short nKeyInd = 0; nKeyInd < 4; ++nKeyInd )
@@ -286,7 +276,7 @@ namespace
return OString(sKeyId);
}
- //Split string at the delimiter char
+ //Split string at the delimiter character
static void lcl_SplitAt(const OString& rSource, const sal_Char nDelimiter,
std::vector<OString>& o_vParts)
{
@@ -698,21 +688,6 @@ PoHeader::~PoHeader()
delete m_pGenPo;
}
-//Get the language of header
-OString PoHeader::getLanguage() const
-{
- assert( m_bIsInitialized );
- const OString sLang = "Language: ";
- const OString sMsgStr = m_pGenPo->getMsgStr();
- const sal_Int32 nFirstIndex = sMsgStr.indexOf(sLang)+sLang.getLength();
- const sal_Int32 nCount = sMsgStr.indexOf('\n',nFirstIndex)-nFirstIndex;
- if( nFirstIndex == sLang.getLength()-1 || nCount == -nFirstIndex-1 )
- {
- throw NOLANG;
- }
- return sMsgStr.copy( nFirstIndex, nCount );
-}
-
//Class PoOfstream
PoOfstream::PoOfstream()