Remove sprintf with translations

don't use sprintf with translation functions
This commit is contained in:
Adam Magness 2018-01-23 22:59:20 -05:00
parent a43901ba07
commit b191d5716c
15 changed files with 36 additions and 35 deletions

View file

@ -136,7 +136,7 @@ function blockem_prepare_body(&$a,&$b) {
}
if($found) {
$rnd = random_string(8);
$b['html'] = '<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . sprintf(L10n::t('Blocked %s - Click to open/close'),$word ) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
$b['html'] = '<div id="blockem-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'blockem-' . $rnd . '\'); >' . L10n::t('Blocked %s - Click to open/close', $word) . '</div><div id="blockem-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
}
}

View file

@ -227,7 +227,7 @@ function communityhome_home(&$a, &$o){
}
$plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
$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 = '<h1>' . ((x($a->config,'sitename')) ? sprintf(L10n::t("Welcome to %s") ,$a->config['sitename']) : "" ) . '</h1>';
$o = '<h1>' . ((x($a->config,'sitename')) ? L10n::t("Welcome to %s", $a->config['sitename']) : "" ) . '</h1>';
if(file_exists('home.html'))
$o = file_get_contents('home.html');

View file

@ -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;

View file

@ -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']);
}

View file

@ -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 = '<h5>' .L10n::t('Warning') .'</h5><p>';
$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 .= '<br>' .L10n::t('This addon is not functional on your server.') .'<p><br>';
return;
}

View file

@ -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();

View file

@ -165,6 +165,6 @@ function nsfw_prepare_body(&$a,&$b) {
if ($found) {
$rnd = random_string(8);
$b['html'] = '<div id="nsfw-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'nsfw-' . $rnd . '\'); >' . sprintf(L10n::t('%s - Click to open/close'), $word) . '</div><div id="nsfw-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
$b['html'] = '<div id="nsfw-wrap-' . $rnd . '" class="fakelink" onclick=openClose(\'nsfw-' . $rnd . '\'); >' . L10n::t('%s - Click to open/close', $word) . '</div><div id="nsfw-' . $rnd . '" style="display: none; " >' . $b['html'] . '</div>';
}
}

View file

@ -82,7 +82,7 @@ function piwik_analytics($a,&$b) {
$b .= L10n::t("This website is tracked using the <a href='http://www.piwik.org'>Piwik</a> 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 <a href='%s'>can set a cookie to prevent Piwik from tracking further visits of the site</a> (opt-out)."), $the_url);
$b .= L10n::t("If you do not want that your visits are logged in this way you <a href='%s'>can set a cookie to prevent Piwik from tracking further visits of the site</a> (opt-out).", $the_url);
$b .= "</div>";
}
}

View file

@ -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]");
}
}

View file

@ -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'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' .
'<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';

View file

@ -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,7 +31,7 @@ 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.'<div class="renderinfo">'.sprintf(t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"),
$o = $o.'<div class="renderinfo">'. 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),

View file

@ -125,7 +125,7 @@ function showmore_prepare_body(&$a,&$b) {
if($found) {
$rnd = random_string(8);
$b['html'] = '<span id="showmore-teaser-'.$rnd.'" class="showmore-teaser" style="display: block;">'.$shortened." ".
'<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="showmore-wrap fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.sprintf(L10n::t('show more')).'</span></span>'.
'<span id="showmore-wrap-'.$rnd.'" style="white-space:nowrap;" class="showmore-wrap fakelink" onclick="openClose(\'showmore-'.$rnd.'\'); openClose(\'showmore-teaser-'.$rnd.'\');" >'.L10n::t('show more').'</span></span>'.
'<div id="showmore-'.$rnd.'" class="showmore-content" style="display: none;">'.$b['html'].'</div>';
}
}

View file

@ -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());
}
}

View file

@ -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(),
]);

View file

@ -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.