Added: Translation for core classes

Co-authored-by: Name <sumit201@webkul.in>
This commit is contained in:
varun kewlani
2026-06-30 16:05:39 +05:30
parent 7e99163195
commit 44550cf86f
6 changed files with 205 additions and 60 deletions

View File

@@ -1122,6 +1122,25 @@ abstract class ObjectModelCore implements Core_Foundation_Database_EntityInterfa
return ((is_array($_FIELDS) && array_key_exists($key, $_FIELDS)) ? ($htmlentities ? htmlentities($_FIELDS[$key], ENT_QUOTES, 'utf-8') : $_FIELDS[$key]) : $field);
}
/**
* Get a translation for this core class.
* Strings translated via Localization > Translations > Core class translations.
*
* @param string $string String to translate (must be a literal for the scanner)
* @param string $class Class context (defaults to calling class)
* @return string
*/
public static function l($string, $class = null)
{
if (!$class) {
$class = get_called_class();
if (substr($class, -4) === 'Core') {
$class = substr($class, 0, -4);
}
}
return Translate::getClassTranslation($string, $class);
}
/**
* @deprecated 1.5.0.1 Use validateController() instead
* @param bool $htmlentities