79 $factory->loadLanguage($this->code);
80 foreach ($factory->keys as $key) {
83 $this->_loaded =
true;
93 if (!$this->_loaded) {
96 if (!isset($this->messages[$key])) {
99 return $this->messages[$key];
109 if (!$this->_loaded) {
112 if (!isset($this->errorNames[$int])) {
113 return "[Error: $int]";
115 return $this->errorNames[$int];
126 $sep_last = $this->
getMessage(
'Item separator last');
128 for ($i = 0, $c = count($array); $i < $c; $i++) {
130 } elseif ($i + 1 < $c) {
150 if (!$this->_loaded) {
153 if (!isset($this->messages[$key])) {
156 $raw = $this->messages[$key];
159 foreach ($args as $i => $value) {
160 if (is_object($value)) {
164 $generator = $this->context->get(
'Generator');
166 if (isset($value->name)) {
167 $subst[
'$'.$i.
'.Name'] = $value->name;
169 if (isset($value->data)) {
170 $subst[
'$'.$i.
'.Data'] = $value->data;
172 $subst[
'$'.$i.
'.Compact'] =
173 $subst[
'$'.$i.
'.Serialized'] = $generator->generateFromToken($value);
177 if (!empty($value->attr)) {
178 $stripped_token = clone $value;
179 $stripped_token->attr = array();
180 $subst[
'$'.$i.
'.Compact'] = $generator->generateFromToken($stripped_token);
182 $subst[
'$'.$i.
'.Line'] = $value->line ? $value->line :
'unknown';
185 } elseif (is_array($value)) {
186 $keys = array_keys($value);
187 if (array_keys($keys) === $keys) {
189 $subst[
'$'.$i] = $this->
listify($value);
193 $subst[
'$'.$i.
'.Keys'] = $this->
listify($keys);
194 $subst[
'$'.$i.
'.Values'] = $this->
listify(array_values($value));
198 $subst[
'$' . $i] = $value;
200 return strtr($raw, $subst);