Commit 72ec44ba authored by Franco Fichtner's avatar Franco Fichtner

src: unify gettext() usage for #265

parent 93c9b29a
...@@ -387,7 +387,7 @@ function local_user_set(&$user) ...@@ -387,7 +387,7 @@ function local_user_set(&$user)
{ {
if (empty($user['password'])) { if (empty($user['password'])) {
log_error(sprintf( log_error(sprintf(
_('There is something wrong in your config because user %s password is missing!'), gettext('There is something wrong in your config because user %s password is missing!'),
$user['name'] $user['name']
)); ));
return; return;
......
...@@ -226,7 +226,7 @@ function session_auth() { ...@@ -226,7 +226,7 @@ function session_auth() {
exit; exit;
} else { } else {
/* give the user an error message */ /* give the user an error message */
$_SESSION['Login_Error'] = _('Wrong username or password.'); $_SESSION['Login_Error'] = gettext('Wrong username or password.');
log_error("webConfigurator authentication error for '{$_POST['usernamefld']}' from {$_SERVER['REMOTE_ADDR']}"); log_error("webConfigurator authentication error for '{$_POST['usernamefld']}' from {$_SERVER['REMOTE_ADDR']}");
if (isAjax()) { if (isAjax()) {
echo "showajaxmessage('{$_SESSION['Login_Error']}');"; echo "showajaxmessage('{$_SESSION['Login_Error']}');";
......
...@@ -44,7 +44,7 @@ function _crypt_data($val, $pass, $opt) ...@@ -44,7 +44,7 @@ function _crypt_data($val, $pass, $opt)
if (file_exists("{$file}.enc")) { if (file_exists("{$file}.enc")) {
$result = file_get_contents("{$file}.enc"); $result = file_get_contents("{$file}.enc");
} else { } else {
log_error(_('Failed to encrypt/decrypt data!')); log_error(gettext('Failed to encrypt/decrypt data!'));
} }
@unlink($file); @unlink($file);
......
...@@ -2020,7 +2020,7 @@ function filter_generate_port(& $rule, $target = "source", $isnat = false) { ...@@ -2020,7 +2020,7 @@ function filter_generate_port(& $rule, $target = "source", $isnat = false) {
$srcport = explode("-", $rule[$target]['port']); $srcport = explode("-", $rule[$target]['port']);
$srcporta = alias_expand($srcport[0]); $srcporta = alias_expand($srcport[0]);
if (!$srcporta) { if (!$srcporta) {
log_error(sprintf( _('filter_generate_port: %s is not a valid %s port.'), $srcport[0], $target)); log_error(sprintf(gettext('filter_generate_port: %s is not a valid %s port.'), $srcport[0], $target));
} elseif (empty($srcport[1]) || $srcport[0] == $srcport[1]) { } elseif (empty($srcport[1]) || $srcport[0] == $srcport[1]) {
$src .= " port {$srcporta} "; $src .= " port {$srcporta} ";
} else if(($srcport[0] == 1) && ($srcport[1] == 65535)) { } else if(($srcport[0] == 1) && ($srcport[1] == 65535)) {
......
...@@ -821,15 +821,15 @@ function return_gateway_groups_array() ...@@ -821,15 +821,15 @@ function return_gateway_groups_array()
$status = $gateways_status[$gwname]; $status = $gateways_status[$gwname];
$gwdown = false; $gwdown = false;
if (stristr($status['status'], 'down')) { if (stristr($status['status'], 'down')) {
$msg = sprintf(_('MONITOR: %s is down, removing from routing group %s'), $gwname, $group['name']); $msg = sprintf(gettext('MONITOR: %s is down, removing from routing group %s'), $gwname, $group['name']);
$gwdown = true; $gwdown = true;
} elseif (stristr($status['status'], 'loss') && strstr($group['trigger'], 'loss')) { } elseif (stristr($status['status'], 'loss') && strstr($group['trigger'], 'loss')) {
/* packet loss */ /* packet loss */
$msg = sprintf(_('MONITOR: %s has packet loss, removing from routing group %s'), $gwname, $group['name']); $msg = sprintf(gettext('MONITOR: %s has packet loss, removing from routing group %s'), $gwname, $group['name']);
$gwdown = true; $gwdown = true;
} elseif (stristr($status['status'], 'delay') && strstr($group['trigger'] , 'latency')) { } elseif (stristr($status['status'], 'delay') && strstr($group['trigger'] , 'latency')) {
/* high latency */ /* high latency */
$msg = sprintf(_('MONITOR: %s has high latency, removing from routing group %s'), $gwname, $group['name']); $msg = sprintf(gettext('MONITOR: %s has high latency, removing from routing group %s'), $gwname, $group['name']);
$gwdown = true; $gwdown = true;
} }
if ($gwdown == true) { if ($gwdown == true) {
...@@ -850,7 +850,7 @@ function return_gateway_groups_array() ...@@ -850,7 +850,7 @@ function return_gateway_groups_array()
if ($tiers_count == 0) { if ($tiers_count == 0) {
/* Oh dear, we have no members! Engage Plan B */ /* Oh dear, we have no members! Engage Plan B */
if (!file_exists('/var/run/booting')) { if (!file_exists('/var/run/booting')) {
$msg = sprintf(_('Gateways status could not be determined, considering all as up/active. (Group: %s)'), $group['name']); $msg = sprintf(gettext('Gateways status could not be determined, considering all as up/active. (Group: %s)'), $group['name']);
log_error($msg); log_error($msg);
notify_via_growl($msg); notify_via_growl($msg);
//notify_via_smtp($msg); //notify_via_smtp($msg);
......
...@@ -1029,13 +1029,13 @@ function process_alias_unzip($temp_filename) { ...@@ -1029,13 +1029,13 @@ function process_alias_unzip($temp_filename) {
/* foreach through all extracted files and build up aliases file */ /* foreach through all extracted files and build up aliases file */
$fd = @fopen("{$temp_filename}/aliases", "w"); $fd = @fopen("{$temp_filename}/aliases", "w");
if (!$fd) { if (!$fd) {
log_error(sprintf(_('Could not open %s/aliases for writing!'), $temp_filename)); log_error(sprintf(gettext('Could not open %s/aliases for writing!'), $temp_filename));
return false; return false;
} }
foreach($files_to_process as $f2p) { foreach($files_to_process as $f2p) {
$tmpfd = @fopen($f2p, 'r'); $tmpfd = @fopen($f2p, 'r');
if (!$tmpfd) { if (!$tmpfd) {
log_error(sprintf(_('The following file could not be read %s from %s'), $f2p, $temp_filename)); log_error(sprintf(gettext('The following file could not be read %s from %s'), $f2p, $temp_filename));
continue; continue;
} }
while (($tmpbuf = fread($tmpfd, 65536)) !== FALSE) while (($tmpbuf = fread($tmpfd, 65536)) !== FALSE)
...@@ -1061,13 +1061,13 @@ function process_alias_tgz($temp_filename) { ...@@ -1061,13 +1061,13 @@ function process_alias_tgz($temp_filename) {
/* foreach through all extracted files and build up aliases file */ /* foreach through all extracted files and build up aliases file */
$fd = @fopen("{$temp_filename}/aliases", "w"); $fd = @fopen("{$temp_filename}/aliases", "w");
if (!$fd) { if (!$fd) {
log_error(sprintf(_('Could not open %s/aliases for writing!'), $temp_filename)); log_error(sprintf(gettext('Could not open %s/aliases for writing!'), $temp_filename));
return false; return false;
} }
foreach($files_to_process as $f2p) { foreach($files_to_process as $f2p) {
$tmpfd = @fopen($f2p, 'r'); $tmpfd = @fopen($f2p, 'r');
if (!$tmpfd) { if (!$tmpfd) {
log_error(sprintf(_('The following file could not be read %s from %s'), $f2p, $temp_filename)); log_error(sprintf(gettext('The following file could not be read %s from %s'), $f2p, $temp_filename));
continue; continue;
} }
while (($tmpbuf = fread($tmpfd, 65536)) !== FALSE) while (($tmpbuf = fread($tmpfd, 65536)) !== FALSE)
......
...@@ -2248,7 +2248,7 @@ EOD; ...@@ -2248,7 +2248,7 @@ EOD;
if (($wanip != $cachedipv4) || (($currentTime - $cacheTimev4) > $maxCacheAgeSecs) || $forced) { if (($wanip != $cachedipv4) || (($currentTime - $cacheTimev4) > $maxCacheAgeSecs) || $forced) {
$upinst .= "update delete {$dnsupdate['host']}. A\n"; $upinst .= "update delete {$dnsupdate['host']}. A\n";
$upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} A {$wanip}\n"; $upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} A {$wanip}\n";
$notify_text .= sprintf(_('DynDNS updated IP Address (A) for %s on %s (%s) to %s'), $dnsupdate['host'], convert_real_interface_to_friendly_descr($if), $if, $wanip) . "\n"; $notify_text .= sprintf(gettext('DynDNS updated IP Address (A) for %s on %s (%s) to %s'), $dnsupdate['host'], convert_real_interface_to_friendly_descr($if), $if, $wanip) . "\n";
@file_put_contents($cacheFile, "{$wanip}|{$currentTime}"); @file_put_contents($cacheFile, "{$wanip}|{$currentTime}");
log_error("phpDynDNS: updating cache file {$cacheFile}: {$wanip}"); log_error("phpDynDNS: updating cache file {$cacheFile}: {$wanip}");
$need_update = true; $need_update = true;
...@@ -2263,7 +2263,7 @@ EOD; ...@@ -2263,7 +2263,7 @@ EOD;
if (($wanipv6 != $cachedipv6) || (($currentTime - $cacheTimev6) > $maxCacheAgeSecs) || $forced) { if (($wanipv6 != $cachedipv6) || (($currentTime - $cacheTimev6) > $maxCacheAgeSecs) || $forced) {
$upinst .= "update delete {$dnsupdate['host']}. AAAA\n"; $upinst .= "update delete {$dnsupdate['host']}. AAAA\n";
$upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} AAAA {$wanipv6}\n"; $upinst .= "update add {$dnsupdate['host']}. {$dnsupdate['ttl']} AAAA {$wanipv6}\n";
$notify_text .= sprintf(_('DynDNS updated IPv6 Address (AAAA) for %s on %s (%s) to %s'), $dnsupdate['host'], convert_real_interface_to_friendly_descr($if), $if, $wanipv6) . "\n"; $notify_text .= sprintf(gettext('DynDNS updated IPv6 Address (AAAA) for %s on %s (%s) to %s'), $dnsupdate['host'], convert_real_interface_to_friendly_descr($if), $if, $wanipv6) . "\n";
@file_put_contents("{$cacheFile}.ipv6", "{$wanipv6}|{$currentTime}"); @file_put_contents("{$cacheFile}.ipv6", "{$wanipv6}|{$currentTime}");
log_error("phpDynDNS: updating cache file {$cacheFile}.ipv6: {$wanipv6}"); log_error("phpDynDNS: updating cache file {$cacheFile}.ipv6: {$wanipv6}");
$need_update = true; $need_update = true;
......
...@@ -34,20 +34,20 @@ require_once('functions.inc'); ...@@ -34,20 +34,20 @@ require_once('functions.inc');
$fp = fopen('php://stdin', 'r'); $fp = fopen('php://stdin', 'r');
printf( printf(
_('The %s password will be reset to the factory default of `%s\'.'), gettext('The %s password will be reset to the factory default of `%s\'.'),
$g['factory_shipped_username'], $g['factory_shipped_username'],
$g['factory_shipped_password'] $g['factory_shipped_password']
); );
printf("\n\n"); printf("\n\n");
printf(_('Do you want to proceed [y|n]? ')); printf(gettext('Do you want to proceed [y|n]? '));
if (strcasecmp(chop(fgets($fp)), 'y') == 0) { if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
if (isset($config['system']['webgui']['authmode']) && if (isset($config['system']['webgui']['authmode']) &&
$config['system']['webgui']['authmode'] != 'Local Database') { $config['system']['webgui']['authmode'] != 'Local Database') {
printf("\n\n"); printf("\n\n");
printf(_('The User manager authentication server is set to "%s".'), $config['system']['webgui']['authmode']); printf(gettext('The User manager authentication server is set to "%s".'), $config['system']['webgui']['authmode']);
printf("\n"); printf("\n");
printf(_('Do you want to set it back to Local Database [y|n]? ')); printf(gettext('Do you want to set it back to Local Database [y|n]? '));
if (strcasecmp(chop(fgets($fp)), 'y') == 0) { if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
$config['system']['webgui']['authmode'] = 'Local Database'; $config['system']['webgui']['authmode'] = 'Local Database';
} }
...@@ -75,8 +75,8 @@ if (strcasecmp(chop(fgets($fp)), 'y') == 0) { ...@@ -75,8 +75,8 @@ if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
write_config($config, gettext("password changed from console menu")); write_config($config, gettext("password changed from console menu"));
printf("\n\n"); printf("\n\n");
printf(_("The password has been reset.")); printf(gettext("The password has been reset."));
printf("\n"); printf("\n");
printf(_("Please change the password as soon as you log in!")); printf(gettext("Please change the password as soon as you log in!"));
printf("\n\n"); printf("\n\n");
} }
...@@ -130,14 +130,14 @@ foreach ($keys as $name) { ...@@ -130,14 +130,14 @@ foreach ($keys as $name) {
} }
if ($generate_keys) { if ($generate_keys) {
log_error(_('Started creating your SSH keys. SSH startup is being delayed a wee bit.')); log_error(gettext('Started creating your SSH keys. SSH startup is being delayed a wee bit.'));
mark_subsystem_dirty('sshdkeys'); mark_subsystem_dirty('sshdkeys');
mwexec("/bin/rm -f {$etc_ssh}/ssh_host_*"); mwexec("/bin/rm -f {$etc_ssh}/ssh_host_*");
foreach ($keys as $type => $name) { foreach ($keys as $type => $name) {
mwexec(sprintf('%s -t %s -N "" -f %s/%s', $bin_ssh_keygen, $type, $etc_ssh, $name)); mwexec(sprintf('%s -t %s -N "" -f %s/%s', $bin_ssh_keygen, $type, $etc_ssh, $name));
} }
clear_subsystem_dirty('sshdkeys'); clear_subsystem_dirty('sshdkeys');
log_error(_('Completed creating your SSH keys. SSH will now be started.')); log_error(gettext('Completed creating your SSH keys. SSH will now be started.'));
} }
/* Launch new server process */ /* Launch new server process */
......
...@@ -64,7 +64,7 @@ function update_alias_url_data() ...@@ -64,7 +64,7 @@ function update_alias_url_data()
if (file_exists("{$temp_filename}/aliases")) { if (file_exists("{$temp_filename}/aliases")) {
$fd = @fopen("{$temp_filename}/aliases", 'r'); $fd = @fopen("{$temp_filename}/aliases", 'r');
if (!$fd) { if (!$fd) {
log_error(sprintf(_('Could not process aliases from alias: %s'), $alias_url)); log_error(sprintf(gettext('Could not process aliases from alias: %s'), $alias_url));
continue; continue;
} }
/* NOTE: fgetss() is not a typo RTFM before being smart */ /* NOTE: fgetss() is not a typo RTFM before being smart */
......
...@@ -128,7 +128,7 @@ if (!isset($config['voucher'][$cpzone]['magic'])) { ...@@ -128,7 +128,7 @@ if (!isset($config['voucher'][$cpzone]['magic'])) {
if ($_REQUEST['generatekey']) { if ($_REQUEST['generatekey']) {
$key = generatekey($config['voucher'][$cpzone]['exponent']); $key = generatekey($config['voucher'][$cpzone]['exponent']);
$alertmessage = _( $alertmessage = gettext(
'You will need to recreate any existing Voucher Rolls due ' . 'You will need to recreate any existing Voucher Rolls due ' .
'to the public and private key changes. Click cancel if you ' . 'to the public and private key changes. Click cancel if you ' .
'do not wish to recreate the vouchers.' 'do not wish to recreate the vouchers.'
......
...@@ -36,11 +36,11 @@ function get_locale_list() ...@@ -36,11 +36,11 @@ function get_locale_list()
$locales = array(); $locales = array();
/* first one is the default */ /* first one is the default */
$locales['en_US'] = _('English'); $locales['en_US'] = gettext('English');
$locales['de_DE'] = _('German'); $locales['de_DE'] = gettext('German');
/* $locales['es_CO'] = */ _('Spanish'); /* $locales['es_CO'] = */ gettext('Spanish');
/* $locales['ja_JP'] = */ _('Japanese'); /* $locales['ja_JP'] = */ gettext('Japanese');
$locales['zh_CN'] = _('Chinese (Simplified)'); $locales['zh_CN'] = gettext('Chinese (Simplified)');
return $locales; return $locales;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment