You are so kind with your soon guide!!!
point is, in that file looks quite different:
----- MY FILE--------
public function getText($key = null, $args = null, $use = null, $module = null, $lang = null)
{ // TODO: rename the methode to LangText::translate()
// TODO: app_strings and mod_strings could be in separated methods
global $app_strings, $mod_strings, $app_list_strings;
$module = $module ? $module : $this->module;
if (!$mod_strings && $module) {
// retrieve translation for specified module
$lang = $lang ? $lang : ($this->lang ? $this->lang : $GLOBALS['current_language']);
include_once __DIR__ . '/SugarObjects/LanguageManager.php';
\LanguageManager::loadModuleLanguage($module, $lang);
}
if (!is_null($key)) {
$this->key = $key;
}
if (!is_null($args)) {
$this->args = $args;
}
if (!is_null($use)) {
$this->use = $use;
}
if ($this->use === self::USING_MOD_STRINGS) {
$text = isset($mod_strings[$this->key]) && $mod_strings[$this->key] ? $mod_strings[$this->key] : null;
} elseif ($this->use === self::USING_APP_STRINGS) {
$text = isset($app_strings[$this->key]) && $app_strings[$this->key] ? $app_strings[$this->key] : null;
} elseif ($this->use === self::USING_ALL_STRINGS) {
$text = isset($mod_strings[$this->key]) && $mod_strings[$this->key] ? $mod_strings[$this->key] : (
isset($app_strings[$this->key]) ? $app_strings[$this->key] : (
isset($app_list_strings[$this->key]) ? $app_list_strings[$this->key] : null
)
);
} else {
ErrorMessage::drop('Unknown use case for translation: ' . $this->use);
}
if (!$text) {
if ($this->log) {
ErrorMessage::handler('A language key does not found: [' . $this->key . ']', self::LOG_LEVEL, $this->throw);
} else {
$text = $this->key;
}
}
foreach ((array) $this->args as $name => $value) {
$text = str_replace('{' . $name . '}', $value, $text);
}
return $text;
}
-----END OF MY FILE------
-------but in github, this information looks very short, please have a look-------
public function getText($key = null, $args = null, $use = null, $module = null, $lang = null)
{ // TODO: rename the methode to LangText::translate()
$this->selfUpdate($key, $args, $use);
$textResolved = $this->resolveText($module, $lang);
$text = $this->replaceArgs($textResolved);
return $text;
}
maybe is a different version??..
Thks