Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add dynamic to multilang chaining

  • Loading branch information...
commit 654e1a634bb7eace976c836a60b9f047fe1de810 1 parent 3aa3d2f
@pierot pierot authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 app/lib/proximitybbdo/multilang.php
View
15 app/lib/proximitybbdo/multilang.php
@@ -147,8 +147,6 @@ public function _t($key, $lang = '') {
*/
public function _d($key, $regexp, $params) {
if(isset($regexp)) {
- $matches = array();
-
$value = $this->langs[$this->lang][$key];
$value = preg_replace($regexp, $params, $value);
@@ -192,12 +190,25 @@ function __construct($data) {
public function __call($name, array $arguments) {
if($name == '_t' || $name == 't')
return call_user_func_array(array($this, '__t'), $arguments);
+ else if($name == '_d' || $name == 'd')
+ return call_user_func_array(array($this, '__d'), $arguments);
}
private function __t($key) {
return new MultiLangKey($this->_data[$key]);
}
+ private function __d($key, $regexp, $params) {
+ if(isset($regexp)) {
+ $value = $this->_data[$key];
+ $value = preg_replace($regexp, $params, $value);
+
+ return $value;
+ }
+
+ return new MultiLangKey($this->_data[$key]);
+ }
+
public function __toString() {
return (string) $this->_data;
}
Please sign in to comment.
Something went wrong with that request. Please try again.