]> git.mxchange.org Git - friendica.git/blob - include/pgettext.php
use local contact photo if available
[friendica.git] / include / pgettext.php
1 <?php
2 /**
3  * translation support
4  */
5
6 // load string translation table for alternate language
7
8 if(! function_exists('load_translation_table')) {
9 function load_translation_table($lang) {
10         global $a;
11
12         if(file_exists("view/$lang/strings.php"))
13                 include("view/$lang/strings.php");
14 }}
15
16 // translate string if translation exists
17
18 if(! function_exists('t')) {
19 function t($s) {
20
21         $a = get_app();
22
23         if(x($a->strings,$s)) {
24                 $t = $a->strings[$s];
25                 return is_array($t)?$t[0]:$t;
26         }
27         return $s;
28 }}
29
30 if(! function_exists('tt')){
31 function tt($singular, $plural, $count){
32         
33         $a = get_app();
34
35         if(x($a->strings,$singular)) {
36                 $t = $a->strings[$singular];
37                 $k = string_plural_select($count);
38                 return is_array($t)?$t[$k]:$t;
39         }
40         
41         if ($count!=1){
42                 return $plural;
43         } else {
44                 return $singular;
45         }
46 }}