From 8a40c718fb9f9272ea99094a760f399e323cd66c Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Fri, 11 Mar 2011 00:18:29 +0100 Subject: Move translation functions. Add tt() for plural cases. --- boot.php | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 4c3a923dc..19c6d8878 100644 --- a/boot.php +++ b/boot.php @@ -159,6 +159,11 @@ if (get_magic_quotes_gpc()) { unset($process); } +/* + * translation system + */ +require_once("include/pgettext.php"); + /** * @@ -601,28 +606,6 @@ function replace_macros($s,$r) { }} -// load string translation table for alternate language - -if(! function_exists('load_translation_table')) { -function load_translation_table($lang) { - global $a; - - if(file_exists("view/$lang/strings.php")) - include("view/$lang/strings.php"); -}} - -// translate string if translation exists - -if(! function_exists('t')) { -function t($s) { - - $a = get_app(); - - if(x($a->strings,$s)) - return $a->strings[$s]; - return $s; -}} - // curl wrapper. If binary flag is true, return binary // results. -- cgit v1.2.3 From 3d323fd2608d58164f2fb1889f508b2796190f23 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 17 Mar 2011 00:32:24 -0700 Subject: condense birthday display --- boot.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d02ecd344..330c965f4 100644 --- a/boot.php +++ b/boot.php @@ -2423,7 +2423,13 @@ function get_birthdays() { ); if($r && count($r)) { - $o .= '
' . t('Birthdays this week:') . '
'; + $total = 0; + foreach($r as $rr) + if(strlen($rr['name'])) + $total ++; + + $o .= ''; + $o .= '' ; } - $o .= '
'; + $o .= ''; } return $o; -- cgit v1.2.3 From 90178f86cb02cc3b6d2b7e5d49222dfeec0e8921 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 17 Mar 2011 14:41:36 -0700 Subject: revup --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 330c965f4..389ea93a9 100644 --- a/boot.php +++ b/boot.php @@ -2,7 +2,7 @@ set_time_limit(0); -define ( 'FRIENDIKA_VERSION', '2.1.920' ); +define ( 'FRIENDIKA_VERSION', '2.1.921' ); define ( 'DFRN_PROTOCOL_VERSION', '2.1' ); define ( 'DB_UPDATE_VERSION', 1043 ); -- cgit v1.2.3 From 7df8e18dd1917de9df359094e0ff486f47e4a08d Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Fri, 18 Mar 2011 11:02:42 +0100 Subject: Update more strings --- boot.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 19c6d8878..ac57d1e51 100644 --- a/boot.php +++ b/boot.php @@ -1828,10 +1828,14 @@ if(! function_exists('format_like')) { function format_like($cnt,$arr,$type,$id) { $o = ''; if($cnt == 1) - $o .= $arr[0] . (($type === 'like') ? t(' likes this.') : t(' doesn\'t like this.')) . EOL ; + $o .= (($type === 'like') ? sprintf( t('%s likes this.'), $arr[0]) : sprintf( t('%s doesn\'t like this.'), $arr[0])) . EOL ; else { - $o .= '' - . $cnt . ' ' . t('people') . ' ' . (($type === 'like') ? t('like this.') : t('don\'t like this.')) . EOL ; + $spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"'; + $o .= (($type === 'like') ? + sprintf( t('%2$d people like this.'), $spanatts, $cnt) + : + sprintf( t('%2$d people don\'t like this.'), $spanatts, $cnt) ); + $o .= EOL ; $total = count($arr); if($total >= MAX_LIKERS) $arr = array_slice($arr, 0, MAX_LIKERS - 1); @@ -1839,8 +1843,8 @@ function format_like($cnt,$arr,$type,$id) { $arr[count($arr)-1] = t('and') . ' ' . $arr[count($arr)-1]; $str = implode(', ', $arr); if($total >= MAX_LIKERS) - $str .= t(', and ') . $total - MAX_LIKERS . t(' other people'); - $str .= (($type === 'like') ? t(' like this.') : t(' don\'t like this.')); + $str .= sprintf( t(', and %d other people'), $total - MAX_LIKERS ); + $str = (($type === 'like') ? sprintf( t('%s like this.'), $str) : sprintf( t('%s don\'t like this.'), $str)); $o .= "\t" . ''; } return $o; -- cgit v1.2.3