Skip to content

Commit

Permalink
add additional wrapper functions '__x' and '__xn'
Browse files Browse the repository at this point in the history
tiny wrapper functions to describe the context of translatable strings.
  • Loading branch information
browniebraun committed Apr 1, 2016
1 parent 1f039ec commit 515f37d
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion include/global_languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,23 @@ function __() {
}
}


function __xn($context, $singular, $plural, $number, $domain = 'cacti'){
return __n($singular, $plural, $number, $domain);
}

function __x(){
$args = func_get_args();
$num = func_num_args();

/* this should never happen */
if ($num < 2) {
return false;
}else {
$context = array_shift($args);
return call_user_func_array('__', $args);
}
}

function __date($format, $timestamp = false, $domain = 'cacti') {

global $i18n_date_placeholders;
Expand Down Expand Up @@ -342,6 +358,23 @@ function __() {
}
}

function __xn($context, $singular, $plural, $number, $domain = 'cacti'){
return __n($singular, $plural, $number, $domain);
}

function __x(){
$args = func_get_args();
$num = func_num_args();

/* this should never happen */
if ($num < 2) {
return false;
}else {
$context = array_shift($args);
return call_user_func_array('__', $args);
}
}

function __date($format, $timestamp = false, $domain = 'cacti') {
if (!$timestamp) {$timestamp = time();}
return date($format, $timestamp);
Expand Down

0 comments on commit 515f37d

Please sign in to comment.