33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-10-31 18:52:31 +00:00

Check for spaces around the translation string (just a notice for en-GB language)

This commit is contained in:
Denis Ryabov 2021-03-09 23:48:46 +03:00
parent adb548249d
commit cfe16c16d0
2 changed files with 11 additions and 0 deletions

View File

@ -101,6 +101,7 @@ COM_JEDCHECKER_LANG_QQ_DEPRECATED="Usage of \"_QQ_\" is deprecated since Joomla!
COM_JEDCHECKER_LANG_UNESCAPED_QUOTE="Unescaped double quotation mark found"
COM_JEDCHECKER_LANG_VARIABLE_REF="A variable reference found in the translation string."
COM_JEDCHECKER_LANG_INCORRECT_ARGNUM="Probably you use incorrect placeholder format (e.g. '%1s' instead of '%1$s'), see <a href='https://www.php.net/manual/en/function.sprintf.php'>printf's argnum format specification</a> for details"
COM_JEDCHECKER_LANG_SPACES_AROUND="Spaces around the translation string are detected"
COM_JEDCHECKER_TOOLBAR_CHECK="Check"
COM_JEDCHECKER_TOOLBAR_CLEAR="Clear"
COM_JEDCHECKER_CLICK_TO_VIEW_DETAILS="Click to View Details"

View File

@ -299,6 +299,16 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_INCORRECT_ARGNUM'), $startLineno, $line);
}
}
// Some extra checks for en-GB only (to don't duplicate false-positives)
if ($tag === 'en-GB')
{
// Check spaces around (but allow trailing space after colon)
if (preg_match('/^\s|[^:]\s+$/', $value))
{
$this->report->addInfo($file, JText::_('COM_JEDCHECKER_LANG_SPACES_AROUND'), $startLineno, $line);
}
}
}
// All checks passed. Return true