summaryrefslogtreecommitdiff
path: root/src/rules/po.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rules/po.cpp')
-rw-r--r--src/rules/po.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/rules/po.cpp b/src/rules/po.cpp
index d600d19..edfb787 100644
--- a/src/rules/po.cpp
+++ b/src/rules/po.cpp
@@ -28,6 +28,17 @@ bool skipOneCheck(false);
std::string msgId;
std::string msgStr;
+static int countStartSpaces(const std::string &str)
+{
+ const int sz = str.size();
+ for (int f = 0; f < sz; f ++)
+ {
+ if (str[f] != ' ')
+ return f;
+ }
+ return -1;
+}
+
static void processMessage(RuleBase *const rule)
{
// rule->print(std::string("pair: ").append(msgId).append(
@@ -73,6 +84,7 @@ static void processMessage(RuleBase *const rule)
if (name.find("po/unused/") != std::string::npos)
return;
+ bool isError(false);
if (eId == '.' ||
eId == ',' ||
eId == '!' ||
@@ -86,7 +98,10 @@ static void processMessage(RuleBase *const rule)
eId == ' ')
{
if (eId != eStr)
+ {
rule->print("Wrong character at end of translation line.");
+ isError = true;
+ }
}
if (sId == '.' ||
sId == ',' ||
@@ -101,13 +116,21 @@ static void processMessage(RuleBase *const rule)
sId == ' ')
{
if (sId != sStr)
+ {
rule->print("Wrong character at start of translation line.");
+ isError = true;
+ }
}
- if (msgId.find("###") != std::string::npos
- && msgStr.find("###") == std::string::npos)
+ if (msgId.find("###") != std::string::npos &&
+ msgStr.find("###") == std::string::npos)
{
rule->print("Missing ### in translation.");
}
+ if (isError == false)
+ {
+ if (countStartSpaces(msgId) != countStartSpaces(msgStr))
+ rule->print("Wrong number of spaces at start of translation line.");
+ }
/*
if (msgId.find("\\n") != std::string::npos)
{