33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-12-31 21:51:46 +00:00

few more checks for translation keys validation

This commit is contained in:
Denis Ryabov 2021-02-23 23:49:12 +03:00
parent dcf4801eec
commit 2866d24e59
2 changed files with 12 additions and 0 deletions

View File

@ -87,6 +87,8 @@ COM_JEDCHECKER_LANG_KEY_EMPTY="Empty key name"
COM_JEDCHECKER_LANG_KEY_WHITESPACE="Whitespace in the key is not allowed"
COM_JEDCHECKER_LANG_KEY_INVALID_CHARACTER="Incorrect character in the key name"
COM_JEDCHECKER_LANG_KEY_RESERVED="Reserved keyword in the key name"
COM_JEDCHECKER_LANG_KEY_NOT_ASCII="The key name is not ASCII-compatible"
COM_JEDCHECKER_LANG_KEY_NOT_UPPERCASE="The key name is not uppercase"
COM_JEDCHECKER_LANG_KEY_DUPLICATED="The key name was declared previously on line %d"
COM_JEDCHECKER_LANG_TRANSLATION_ERROR="Incorrect translation string"
COM_JEDCHECKER_LANG_TRANSLATION_QUOTES="All translation strings should be in double quotation marks"

View File

@ -143,6 +143,16 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
continue;
}
if (preg_match('/[\x00-\x1F\x80-\xFF]/', $key))
{
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_KEY_NOT_ASCII'), $startLineno, $line);
}
if ($key !== strtoupper($key))
{
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_KEY_NOT_UPPERCASE'), $startLineno, $line);
}
if (isset($keys[$key]))
{
$this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_LANG_KEY_DUPLICATED', $keys[$key]), $startLineno, $line);