From 72a633dc51b98b25c740a9cb392acfaad77148d8 Mon Sep 17 00:00:00 2001 From: Alexandre Hannud Abdo Date: Wed, 21 May 2014 04:48:22 -0300 Subject: Make translation contexts effective. --- include/language.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/language.php') diff --git a/include/language.php b/include/language.php index f4c7d1524..ba14c33be 100644 --- a/include/language.php +++ b/include/language.php @@ -153,8 +153,9 @@ function load_translation_table($lang, $install = false) { function t($s,$ctx = '') { global $a; - if(x($a->strings,$s)) { - $t = $a->strings[$s]; + $cs = $ctx?"__ctx:".$ctx."__ ".$s:$s; + if(x($a->strings,$cs)) { + $t = $a->strings[$cs]; return is_array($t) ? $t[0] : $t; } return $s; -- cgit v1.2.3 From d15e3776f3ec5476b1614f0488e8e81e0f0ebb70 Mon Sep 17 00:00:00 2001 From: Alexandre Hannud Abdo Date: Wed, 21 May 2014 05:32:46 -0300 Subject: Allow translation context with plural. Use that in Likes/Dislikes. --- include/language.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/language.php') diff --git a/include/language.php b/include/language.php index ba14c33be..780dfadba 100644 --- a/include/language.php +++ b/include/language.php @@ -162,11 +162,12 @@ function t($s,$ctx = '') { } -function tt($singular, $plural, $count){ +function tt($singular, $plural, $count, $ctx = ''){ $a = get_app(); - if(x($a->strings,$singular)) { - $t = $a->strings[$singular]; + $cs = $ctx?"__ctx:".$ctx."__ ".$singular:$singular; + if(x($a->strings,$cs)) { + $t = $a->strings[$cs]; $f = 'string_plural_select_' . str_replace('-', '_', $a->language); if(! function_exists($f)) $f = 'string_plural_select_default'; -- cgit v1.2.3