From b191d5716c850b5b5b44d46a265a1108b838a320 Mon Sep 17 00:00:00 2001 From: Adam Magness Date: Tue, 23 Jan 2018 22:59:20 -0500 Subject: [PATCH] Remove sprintf with translations don't use sprintf with translation functions --- blockem/blockem.php | 2 +- communityhome/communityhome.php | 4 ++-- diaspora/diaspora.php | 4 ++-- gnot/gnot.php | 2 +- libravatar/libravatar.php | 2 +- notifyall/notifyall.php | 4 ++-- nsfw/nsfw.php | 2 +- piwik/piwik.php | 2 +- public_server/public_server.php | 4 ++-- pumpio/pumpio.php | 4 ++-- rendertime/rendertime.php | 29 ++++++++++++++------------- showmore/showmore.php | 2 +- testdrive/testdrive.php | 4 ++-- widgets/widget_like.php | 4 ++-- windowsphonepush/windowsphonepush.php | 2 +- 15 files changed, 36 insertions(+), 35 deletions(-) diff --git a/blockem/blockem.php b/blockem/blockem.php index 5dd7f4ec9..3f4b88650 100644 --- a/blockem/blockem.php +++ b/blockem/blockem.php @@ -136,7 +136,7 @@ function blockem_prepare_body(&$a,&$b) { } if($found) { $rnd = random_string(8); - $b['html'] = ''; + $b['html'] = ''; } } diff --git a/communityhome/communityhome.php b/communityhome/communityhome.php index 4a9db1129..78d9fe8a9 100644 --- a/communityhome/communityhome.php +++ b/communityhome/communityhome.php @@ -227,7 +227,7 @@ function communityhome_home(&$a, &$o){ } $plink = '' . $post_type . ''; - $aside['$like_items'][] = sprintf(L10n::t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink); + $aside['$like_items'][] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); } } @@ -236,7 +236,7 @@ function communityhome_home(&$a, &$o){ $tpl = get_markup_template('communityhome.tpl', 'addon/communityhome/'); $a->page['aside'] = replace_macros($tpl, $aside); - $o = '

' . ((x($a->config,'sitename')) ? sprintf(L10n::t("Welcome to %s") ,$a->config['sitename']) : "" ) . '

'; + $o = '

' . ((x($a->config,'sitename')) ? L10n::t("Welcome to %s", $a->config['sitename']) : "" ) . '

'; if(file_exists('home.html')) $o = file_get_contents('home.html'); diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index 59b130d75..b486c0956 100644 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -140,9 +140,9 @@ function diaspora_settings(&$a,&$s) { $r = q("SELECT `addr` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user())); if (DBM::is_result($r)) { - $status = sprintf(L10n::t("Please remember: You can always be reached from Diaspora with your Friendica handle %s. "), $r[0]['addr']); + $status = L10n::t("Please remember: You can always be reached from Diaspora with your Friendica handle %s. ", $r[0]['addr']); $status .= L10n::t('This connector is only meant if you still want to use your old Diaspora account for some time. '); - $status .= sprintf(L10n::t('However, it is preferred that you tell your Diaspora contacts the new handle %s instead.'), $r[0]['addr']); + $status .= L10n::t('However, it is preferred that you tell your Diaspora contacts the new handle %s instead.', $r[0]['addr']); } $aspects = false; diff --git a/gnot/gnot.php b/gnot/gnot.php index ccc2c77a8..c7678a218 100644 --- a/gnot/gnot.php +++ b/gnot/gnot.php @@ -96,5 +96,5 @@ function gnot_enotify_mail(&$a,&$b) { if((! $b['uid']) || (! intval(PConfig::get($b['uid'], 'gnot','enable')))) return; if($b['type'] == NOTIFY_COMMENT) - $b['subject'] = sprintf(L10n::t('[Friendica:Notify] Comment to conversation #%d'), $b['parent']); + $b['subject'] = L10n::t('[Friendica:Notify] Comment to conversation #%d', $b['parent']); } diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 14e6c82f9..dd1d613f0 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -88,7 +88,7 @@ function libravatar_addon_admin(&$a, &$o) // Show warning if PHP version is too old if (! version_compare(PHP_VERSION, '5.3.0', '>=')) { $o = '
' .L10n::t('Warning') .'

'; - $o .= sprintf(L10n::t('Your PHP version %s is lower than the required PHP >= 5.3.'), PHP_VERSION); + $o .= L10n::t('Your PHP version %s is lower than the required PHP >= 5.3.', PHP_VERSION); $o .= '
' .L10n::t('This addon is not functional on your server.') .'


'; return; } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 9abde2811..e35d7bf19 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -37,9 +37,9 @@ function notifyall_post(&$a) { $sitename = $a->config['sitename']; if (!x($a->config['admin_name'])) - $sender_name = sprintf(L10n::t('%s Administrator'), $sitename); + $sender_name = L10n::t('%s Administrator', $sitename); else - $sender_name = sprintf(L10n::t('%1$s, %2$s Administrator'), $a->config['admin_name'], $sitename); + $sender_name = L10n::t('%1$s, %2$s Administrator', $a->config['admin_name'], $sitename); if (! x($a->config['sender_email'])) $sender_email = 'noreply@' . $a->get_hostname(); diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index f0fc01772..0782c092b 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -165,6 +165,6 @@ function nsfw_prepare_body(&$a,&$b) { if ($found) { $rnd = random_string(8); - $b['html'] = '

'; + $b['html'] = ''; } } diff --git a/piwik/piwik.php b/piwik/piwik.php index ff141056a..bbec1f6fc 100644 --- a/piwik/piwik.php +++ b/piwik/piwik.php @@ -82,7 +82,7 @@ function piwik_analytics($a,&$b) { $b .= L10n::t("This website is tracked using the Piwik analytics tool."); $b .= " "; $the_url = "http://".$baseurl ."index.php?module=CoreAdminHome&action=optOut"; - $b .= sprintf(L10n::t("If you do not want that your visits are logged in this way you can set a cookie to prevent Piwik from tracking further visits of the site (opt-out)."), $the_url); + $b .= L10n::t("If you do not want that your visits are logged in this way you can set a cookie to prevent Piwik from tracking further visits of the site (opt-out).", $the_url); $b .= ""; } } diff --git a/public_server/public_server.php b/public_server/public_server.php index 1b30b40b3..d3309e6e4 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -125,9 +125,9 @@ function public_server_enotify(&$a, &$b) { if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM && x($b['params'], 'system_type') && $b['params']['system_type'] === 'public_server_expire') { $b['itemlink'] = $a->get_baseurl(); - $b['epreamble'] = $b['preamble'] = sprintf(L10n::t('Your account on %s will expire in a few days.'), Config::get('system','sitename')); + $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename')); $b['subject'] = L10n::t('Your Friendica account is about to expire.'); - $b['body'] = sprintf(L10n::t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days"), $b['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]"); + $b['body'] = L10n::t("Hi %1\$s,\n\nYour account on %2\$s will expire in less than five days. You may keep your account by logging in at least once every 30 days", $b['params']['to_name'], "[url=" . $app->config["system"]["url"] . "]" . $app->config["sitename"] . "[/url]"); } } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 6ab375834..a9c7084dc 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -147,7 +147,7 @@ function pumpio_connect(&$a) { if (($consumer_key == "") || ($consumer_secret == "")) { logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname)); - $o .= sprintf(L10n::t("Unable to register the client at the pump.io server '%s'."), $hostname); + $o .= L10n::t("Unable to register the client at the pump.io server '%s'.", $hostname); return($o); } @@ -968,7 +968,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru $plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]'; $likedata['object-type'] = ACTIVITY_OBJ_NOTE; - $likedata['body'] = sprintf(L10n::t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink); + $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); $likedata['object'] = '' . ACTIVITY_OBJ_NOTE . '1' . '' . $orig_post['uri'] . '' . xmlify('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index 0789f5461..81aea8b18 100644 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -8,6 +8,7 @@ */ use Friendica\Core\Addon; use Friendica\Core\Config; +use Friendica\Core\L10n; function rendertime_install() { Addon::registerHook('page_end', 'addon/rendertime/rendertime.php', 'rendertime_page_end'); @@ -30,20 +31,20 @@ function rendertime_page_end(&$a, &$o) { $ignored = in_array($a->module, $ignored_modules); if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) { - $o = $o.'
'.sprintf(t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"), - round($a->performance["database"] - $a->performance["database_write"], 3), - round($a->performance["database_write"], 3), - round($a->performance["network"], 2), - round($a->performance["rendering"], 2), - round($a->performance["parser"], 2), - round($a->performance["file"], 2), - round($duration - $a->performance["database"] - - $a->performance["network"] - $a->performance["rendering"] - - $a->performance["parser"] - $a->performance["file"], 2), - round($duration, 2) - //round($a->performance["markstart"], 3) - //round($a->performance["plugin"], 3) - )."
"; + $o = $o.'
'. L10n::t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s", + round($a->performance["database"] - $a->performance["database_write"], 3), + round($a->performance["database_write"], 3), + round($a->performance["network"], 2), + round($a->performance["rendering"], 2), + round($a->performance["parser"], 2), + round($a->performance["file"], 2), + round($duration - $a->performance["database"] + - $a->performance["network"] - $a->performance["rendering"] + - $a->performance["parser"] - $a->performance["file"], 2), + round($duration, 2) + //round($a->performance["markstart"], 3) + //round($a->performance["plugin"], 3) + )."
"; if (Config::get("rendertime", "callstack")) { $o .= "
";
diff --git a/showmore/showmore.php b/showmore/showmore.php
index c2d4b1942..89cec83d4 100644
--- a/showmore/showmore.php
+++ b/showmore/showmore.php
@@ -125,7 +125,7 @@ function showmore_prepare_body(&$a,&$b) {
 	if($found) {
 		$rnd = random_string(8);
 		$b['html'] = ''.$shortened." ".
-				''.sprintf(L10n::t('show more')).''.
+				''.L10n::t('show more').''.
 				'';
 	}
 }
diff --git a/testdrive/testdrive.php b/testdrive/testdrive.php
index 6eb9344e6..87c6de33e 100644
--- a/testdrive/testdrive.php
+++ b/testdrive/testdrive.php
@@ -89,8 +89,8 @@ function testdrive_enotify(&$a, &$b) {
     if (x($b, 'params') && $b['params']['type'] == NOTIFY_SYSTEM
 		&& x($b['params'], 'system_type') && $b['params']['system_type'] === 'testdrive_expire') {
         $b['itemlink'] = $a->get_baseurl();
-        $b['epreamble'] = $b['preamble'] = sprintf(L10n::t('Your account on %s will expire in a few days.'), Config::get('system','sitename'));
+        $b['epreamble'] = $b['preamble'] = L10n::t('Your account on %s will expire in a few days.', Config::get('system', 'sitename'));
         $b['subject'] = L10n::t('Your Friendica test account is about to expire.');
-        $b['body'] = sprintf(L10n::t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at http://friendica.com."), $b['params']['to_name'], "[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]", get_server());
+        $b['body'] = L10n::t("Hi %1\$s,\n\nYour test account on %2\$s will expire in less than five days. We hope you enjoyed this test drive and use this opportunity to find a permanent Friendica website for your integrated social communications. A list of public sites is available at %s/siteinfo - and for more information on setting up your own Friendica server please see the Friendica project website at http://friendica.com.", $b['params']['to_name'], "[url=".$app->config["system"]["url"]."]".$app->config["sitename"]."[/url]", get_server());
     }
 }
diff --git a/widgets/widget_like.php b/widgets/widget_like.php
index 279311874..5f03c12eb 100644
--- a/widgets/widget_like.php
+++ b/widgets/widget_like.php
@@ -58,10 +58,10 @@ function like_widget_content(&$a, $conf){
 	$t = get_markup_template("widget_like.tpl", "addon/widgets/");
 	$o .= replace_macros($t, [
 		'$like'		=> $likes,
-		'$strlike'	=> sprintf(L10n::tt("%d person likes this", "%d people like this", $likes), $likes),
+		'$strlike'	=> L10n::tt("%d person likes this", "%d people like this", $likes),
 
 		'$dislike'	=> $dislikes,
-		'$strdislike'=> sprintf(L10n::tt("%d person doesn't like this", "%d people don't like this", $dislikes), $dislikes),
+		'$strdislike'=> L10n::tt("%d person doesn't like this", "%d people don't like this", $dislikes),
 
 		'$baseurl' => $a->get_baseurl(),
 	]);
diff --git a/windowsphonepush/windowsphonepush.php b/windowsphonepush/windowsphonepush.php
index bc19033c1..033d2a64a 100644
--- a/windowsphonepush/windowsphonepush.php
+++ b/windowsphonepush/windowsphonepush.php
@@ -87,7 +87,7 @@ function windowsphonepush_settings_post($a, $post)
 
 	PConfig::set(local_user(), 'windowsphonepush', 'senditemtext', intval($_POST['windowsphonepush-senditemtext']));
 
-	info(t('WindowsPhonePush settings updated.') . EOL);
+	info(L10n::t('WindowsPhonePush settings updated.') . EOL);
 }
 
 /* Called from the Addon Setting form.