58 if ($this->_loaded)
return;
60 $factory->loadLanguage($this->code);
61 foreach ($factory->keys as $key) {
64 $this->_loaded =
true;
73 if (!$this->_loaded) $this->
load();
74 if (!isset($this->messages[$key]))
return "[$key]";
75 return $this->messages[$key];
85 if (!$this->_loaded) $this->
load();
86 if (!isset($this->errorNames[$int]))
return "[Error: $int]";
87 return $this->errorNames[$int];
95 $sep_last = $this->
getMessage(
'Item separator last');
97 for (
$i = 0, $c = count($array);
$i < $c;
$i++) {
99 } elseif (
$i + 1 < $c) {
118 if (!$this->_loaded) $this->
load();
119 if (!isset($this->messages[$key]))
return "[$key]";
120 $raw = $this->messages[$key];
123 foreach ($args as
$i => $value) {
124 if (is_object($value)) {
127 if (!$generator) $generator = $this->context->get(
'Generator');
128 if (isset($value->name)) $subst[
'$'.$i.
'.Name'] = $value->name;
129 if (isset($value->data)) $subst[
'$'.$i.
'.Data'] = $value->data;
130 $subst[
'$'.$i.
'.Compact'] =
131 $subst[
'$'.$i.
'.Serialized'] = $generator->generateFromToken($value);
135 if (!empty($value->attr)) {
136 $stripped_token = clone $value;
137 $stripped_token->attr = array();
138 $subst[
'$'.$i.
'.Compact'] = $generator->generateFromToken($stripped_token);
140 $subst[
'$'.$i.
'.Line'] = $value->line ? $value->line :
'unknown';
143 } elseif (is_array($value)) {
144 $keys = array_keys($value);
145 if (array_keys($keys) === $keys) {
147 $subst[
'$'.$i] = $this->
listify($value);
151 $subst[
'$'.$i.
'.Keys'] = $this->
listify($keys);
152 $subst[
'$'.$i.
'.Values'] = $this->
listify(array_values($value));
156 $subst[
'$' .
$i] = $value;
158 return strtr($raw, $subst);