mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-10-31 18:52:31 +00:00
few more checks for translation values validation
This commit is contained in:
parent
2866d24e59
commit
0e7d8b33a0
@ -94,3 +94,9 @@ 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_EMPTY="Empty translation string"
|
||||
COM_JEDCHECKER_LANG_QQ_DEPRECATED="Usage of \"_QQ_\" is deprecated since Joomla! 3.9. Use escaped double quotes (\\\") instead"
|
||||
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_RECOMMEND_ARGNUM="Substituted values may have another order in other languages. To simplify work of translators, it's recommended to use Argnum specification, see https://www.php.net/manual/en/function.sprintf.php for details"
|
||||
COM_JEDCHECKER_TOOLBAR_CHECK="Check"
|
||||
COM_JEDCHECKER_TOOLBAR_CLEAR="Clear"
|
||||
COM_JEDCHECKER_CLICK_TO_VIEW_DETAILS="Click to View Details"
|
||||
|
@ -209,6 +209,18 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
||||
$this->report->addCompat($file, JText::_('COM_JEDCHECKER_LANG_QQ_DEPRECATED'), $startLineno, $line);
|
||||
}
|
||||
|
||||
$value = str_replace('"_QQ_"', '\"', $value);
|
||||
|
||||
if (preg_match('/[^\\\\]"/', $value))
|
||||
{
|
||||
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_UNESCAPED_QUOTE'), $startLineno, $line);
|
||||
}
|
||||
|
||||
if (strpos($value, '${') !== false)
|
||||
{
|
||||
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_VARIABLE_REF'), $startLineno, $line);
|
||||
}
|
||||
|
||||
// Count %... formats in the string
|
||||
$count1 = preg_match_all('/(?<=^|[^%])%(?=[-+0 ]?\w)/', $value);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user