aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-03-18 05:07:42 -0700
committerFriendika <info@friendika.com>2011-03-18 05:07:42 -0700
commit9838245c6c9b2e311650b53a1c3aa1ef778ef935 (patch)
treeceb9f5edd50cd039e28362a59c4c2d354bb88e67 /boot.php
parent43234a667878327a825914070884161c6d57271e (diff)
parente307846c2d89cf450ed2e7ddf8f325f5f4581f8f (diff)
downloadvolse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.tar.gz
volse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.tar.bz2
volse-hubzilla-9838245c6c9b2e311650b53a1c3aa1ef778ef935.zip
Merge branch 'gettext' of https://github.com/fabrixxm/friendika into fabrixxm-gettext
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php41
1 files changed, 14 insertions, 27 deletions
diff --git a/boot.php b/boot.php
index 389ea93a9..3636288b2 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.
@@ -1845,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 .= '<span class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');" >'
- . $cnt . ' ' . t('people') . '</span> ' . (($type === 'like') ? t('like this.') : t('don\'t like this.')) . EOL ;
+ $spanatts = 'class="fakelink" onclick="openClose(\'' . $type . 'list-' . $id . '\');"';
+ $o .= (($type === 'like') ?
+ sprintf( t('<span %1$s>%2$d people</span> like this.'), $spanatts, $cnt)
+ :
+ sprintf( t('<span %1$s>%2$d people</span> don\'t like this.'), $spanatts, $cnt) );
+ $o .= EOL ;
$total = count($arr);
if($total >= MAX_LIKERS)
$arr = array_slice($arr, 0, MAX_LIKERS - 1);
@@ -1856,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" . '<div id="' . $type . 'list-' . $id . '" style="display: none;" >' . $str . '</div>';
}
return $o;