mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-01 01:03:55 +00:00
check for duplicated translation keys
This commit is contained in:
parent
134e4c0588
commit
a7aa53ac31
@ -87,6 +87,7 @@ COM_JEDCHECKER_LANG_KEY_EMPTY="Empty key name"
|
|||||||
COM_JEDCHECKER_LANG_KEY_WHITESPACE="Whitespace in the key is not allowed"
|
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_INVALID_CHARACTER="Incorrect character in the key name"
|
||||||
COM_JEDCHECKER_LANG_KEY_RESERVED="Reserved keyword in the key name"
|
COM_JEDCHECKER_LANG_KEY_RESERVED="Reserved keyword in the key name"
|
||||||
|
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_ERROR="Incorrect translation string"
|
||||||
COM_JEDCHECKER_LANG_TRANSLATION_QUOTES="All translation strings should be in double quotation marks"
|
COM_JEDCHECKER_LANG_TRANSLATION_QUOTES="All translation strings should be in double quotation marks"
|
||||||
COM_JEDCHECKER_LANG_TRANSLATION_EMPTY="Empty translation string"
|
COM_JEDCHECKER_LANG_TRANSLATION_EMPTY="Empty translation string"
|
||||||
|
@ -73,6 +73,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
|||||||
{
|
{
|
||||||
$lines = file($file);
|
$lines = file($file);
|
||||||
$nLines = count($lines);
|
$nLines = count($lines);
|
||||||
|
$keys = array();
|
||||||
|
|
||||||
for ($lineno = 0; $lineno < $nLines; $lineno++)
|
for ($lineno = 0; $lineno < $nLines; $lineno++)
|
||||||
{
|
{
|
||||||
@ -142,6 +143,15 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($keys[$key]))
|
||||||
|
{
|
||||||
|
$this->report->addWarning($file, JText::sprintf('COM_JEDCHECKER_LANG_KEY_DUPLICATED', $keys[$key]), $startLineno, $line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$keys[$key] = $startLineno;
|
||||||
|
}
|
||||||
|
|
||||||
// Validate value
|
// Validate value
|
||||||
$value = ltrim($value);
|
$value = ltrim($value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user