Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating `Message::translate()` to not extract options and possibly o…

…verwrite arguments.

Fixes #318.
Thanks farhadi for test case and pointing out the source of the bug.
  • Loading branch information...
commit 56c7cb729b6fd773d490810f13ff6614c6431e7a 1 parent 514275d
David Persson davidpersson authored nateabele committed
Showing with 7 additions and 5 deletions.
  1. +7 −5 libraries/lithium/g11n/Message.php
12 libraries/lithium/g11n/Message.php
View
@@ -102,16 +102,18 @@ public static function translate($id, array $options = array()) {
'default' => null,
'noop' => false
);
- extract($options + $defaults);
+ $options += $defaults;
- if ($noop) {
+ if ($options['noop']) {
$result = null;
} else {
- $result = static::_translated($id, abs($count), $locale, compact('scope'));
+ $result = static::_translated($id, abs($options['count']), $options['locale'], array(
+ 'scope' => $options['scope']
+ ));
}
- if ($result || $default) {
- return String::insert($result ?: $default, $options);
+ if ($result || $options['default']) {
+ return String::insert($result ?: $options['default'], $options);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.