Commit c48cf61f authored by Franco Fichtner's avatar Franco Fichtner

rc: remove translations from console

parent af1928de
......@@ -60,7 +60,7 @@ function set_networking_interfaces_ports($probe = false)
$iflist = get_interface_list(false, true);
if ($probe) {
echo PHP_EOL . gettext('Press any key to start the manual interface assignment: ');
echo PHP_EOL . 'Press any key to start the manual interface assignment: ';
$key = timeout();
if (!isset($key)) {
......@@ -79,7 +79,7 @@ Valid interfaces are:
EOD;
if (!is_array($iflist)) {
echo gettext("No interfaces found!") . "\n";
echo "No interfaces found!\n";
$iflist = array();
} else {
foreach ($iflist as $iface => $ifa) {
......@@ -109,7 +109,7 @@ EOD;
}
if (isset($config['vlans']['vlan'])) {
echo "\n\n" . gettext("VLAN interfaces:") . "\n\n";
echo "\n\nVLAN interfaces:\n\n";
foreach ($config['vlans']['vlan'] as $vlan) {
echo sprintf("% -16s%s\n", "{$vlan['if']}_vlan{$vlan['tag']}",
"VLAN tag {$vlan['tag']}, parent interface {$vlan['if']}");
......@@ -126,7 +126,7 @@ hitting 'a' to initiate auto detection.
EOD;
do {
echo "\n" . gettext("Enter the WAN interface name or 'a' for auto-detection:") . " ";
echo "\nEnter the WAN interface name or 'a' for auto-detection: ";
if ($interactive) {
$wanif = chop(fgets($fp));
......@@ -148,15 +148,15 @@ EOD;
}
if (!array_key_exists($wanif, $iflist)) {
printf("\n" . gettext("Invalid interface name '%s'") . "\n", $wanif);
printf("\nInvalid interface name '%s'\n", $wanif);
unset($wanif);
}
} while (!$wanif);
do {
printf(gettext("%sEnter the LAN interface name or 'a' for auto-detection %s" .
"NOTE: this enables full Firewalling/NAT mode.%s" .
"(or nothing if finished):%s"), "\n", "\n", "\n", " ");
echo "\nEnter the LAN interface name or 'a' for auto-detection\n" .
"NOTE: this enables full Firewalling/NAT mode.\n" .
"(or nothing if finished): ";
if ($interactive) {
$lanif = chop(fgets($fp));
......@@ -178,7 +178,7 @@ EOD;
}
if (!array_key_exists($lanif, $iflist)) {
printf(gettext("%sInvalid interface name '%s'%s"), "\n", $lanif, "\n");
printf("\nInvalid interface name '%s'\n", $lanif);
unset($lanif);
}
......@@ -205,11 +205,11 @@ EOD;
$io = $i + 1;
if ($config['interfaces']['opt' . $io]['descr']) {
printf(gettext("%sOptional interface %s description found: %s"), "\n", $io, $config['interfaces']['opt' . $io]['descr']);
printf("\nOptional interface %s description found: %s", $io, $config['interfaces']['opt' . $io]['descr']);
}
printf(gettext("%sEnter the Optional %s interface name or 'a' for auto-detection%s" .
"(or nothing if finished):%s"), "\n", $io, "\n", " ");
printf("\nEnter the Optional %s interface name or 'a' for auto-detection\n" .
"(or nothing if finished): ", $io);
if ($interactive) {
$optif[$i] = chop(fgets($fp));
......@@ -235,7 +235,7 @@ EOD;
}
if (!array_key_exists($optif[$i], $iflist)) {
printf(gettext("%sInvalid interface name '%s'%s"), "\n", $optif[$i], "\n");
printf("\nInvalid interface name '%s'\n", $optif[$i]);
unset($optif[$i]);
continue;
}
......@@ -263,7 +263,7 @@ EOD;
}
}
echo "\n" . gettext("The interfaces will be assigned as follows:") . "\n\n";
echo "\nThe interfaces will be assigned as follows:\n\n";
if ($wanif != '') {
echo "WAN -> " . $wanif . "\n";
......@@ -412,9 +412,10 @@ EOD;
unset($config['interfaces']['opt' . ($i+1)]);
}
printf(gettext("%sWriting configuration..."), "\n");
echo "\nWriting configuration...";
flush();
write_config("Console assignment of interfaces");
printf(gettext("done.%s"), "\n");
echo "done.\n";
fclose($fp);
......@@ -438,13 +439,13 @@ EOD;
if (is_array($iflist)) {
foreach ($iflist as $ifn => $ifa) {
if (!isset($iflist_prev[$ifn])) {
printf(gettext("Detected link-up: %s%s"), $ifn, "\n");
printf("Detected link-up: %s\n", $ifn);
return $ifn;
}
}
}
printf(gettext("No link-up detected.%s"), "\n");
echo "No link-up detected.\n";
return false;
}
......@@ -477,9 +478,9 @@ EOD;
while (1) {
$vlan = array();
echo "\n\n" . gettext("VLAN Capable interfaces:") . "\n\n";
echo "\n\nVLAN-capable interfaces:\n\n";
if(!is_array($iflist)) {
echo gettext("No interfaces found!") . "\n";
echo "No interfaces found!\n";
} else {
$vlan_capable=0;
foreach ($iflist as $iface => $ifa) {
......@@ -492,28 +493,28 @@ EOD;
}
if($vlan_capable == 0) {
echo gettext("No VLAN capable interfaces detected.") . "\n";
echo "No VLAN-capable interfaces detected.\n";
return;
}
echo "\n" . gettext("Enter the parent interface name for the new VLAN (or nothing if finished):") . " ";
echo "\nEnter the parent interface name for the new VLAN (or nothing if finished): ";
$vlan['if'] = chop(fgets($fp));
if ($vlan['if']) {
if (!array_key_exists($vlan['if'], $iflist) or
!is_jumbo_capable($vlan['if'])) {
printf(gettext("%sInvalid interface name '%s'%s"), "\n", $vlan['if'], "\n");
printf("\nInvalid interface name '%s'\n", $vlan['if']);
continue;
}
} else {
break;
}
echo gettext("Enter the VLAN tag (1-4094):") . " ";
echo 'Enter the VLAN tag (1-4094): ';
$vlan['tag'] = chop(fgets($fp));
$vlan['vlanif'] = "{$vlan['if']}_vlan{$vlan['tag']}";
if (!is_numericint($vlan['tag']) || ($vlan['tag'] < 1) || ($vlan['tag'] > 4094)) {
printf(gettext("%sInvalid VLAN tag '%s'%s"), "\n", $vlan['tag'], "\n");
printf("\nInvalid VLAN tag '%s'\n", $vlan['tag']);
continue;
}
......
......@@ -33,20 +33,20 @@ require_once('auth.inc');
$fp = fopen('php://stdin', 'r');
printf(
gettext('The %s password will be reset to the factory default of `%s\'.'),
'The %s password will be reset to the factory default of `%s\'.',
$g['factory_shipped_username'],
$g['factory_shipped_password']
);
printf("\n\n");
printf(gettext('Do you want to proceed [y|n]? '));
printf('Do you want to proceed [y|n]? ');
if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
if (isset($config['system']['webgui']['authmode']) &&
$config['system']['webgui']['authmode'] != 'Local Database') {
printf("\n\n");
printf(gettext('The User manager authentication server is set to "%s".'), $config['system']['webgui']['authmode']);
printf('The User manager authentication server is set to "%s".', $config['system']['webgui']['authmode']);
printf("\n");
printf(gettext('Do you want to set it back to Local Database [y|n]? '));
printf('Do you want to set it back to Local Database [y|n]? ');
if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
$config['system']['webgui']['authmode'] = 'Local Database';
}
......@@ -75,8 +75,8 @@ if (strcasecmp(chop(fgets($fp)), 'y') == 0) {
write_config('Password reset from console menu');
printf("\n\n");
printf(gettext("The password has been reset."));
printf('The password has been reset.');
printf("\n");
printf(gettext("Please change the password as soon as you log in!"));
printf('Please change the password as soon as you log in!');
printf("\n\n");
}
......@@ -10,14 +10,14 @@ $fp = fopen('php://stdin', 'r');
function print_backup_info($backup_info, $number) {
if($backup_info['time'] != 0)
$date = date(gettext("n/j/y H:i:s"), $backup_info['time']);
$date = date('n/j/y H:i:s', $backup_info['time']);
else
$date = gettext("Unknown");
$date = 'Unknown';
list($page, $reason) = explode(": ", $backup_info['description'], 2);
if (empty($reason)) {
$reason = $page;
$page = gettext("Unknown Page");
$page = 'Unknown Page';
}
echo sprintf("%02d", $number) . ". {$date}\tv{$backup_info['version']}\t{$page}\n";
......@@ -30,7 +30,7 @@ function list_backups($which="all") {
global $confvers;
if (count($confvers) == 0) {
echo gettext("No backups found in the configuration history.");
echo 'No backups found in the configuration history.';
return;
}
......@@ -46,16 +46,16 @@ function list_backups($which="all") {
function choose_backup() {
global $fp, $confvers;
if (count($confvers) == 0) {
echo gettext("No backups found in the configuration history.");
echo 'No backups found in the configuration history.';
return -1;
}
echo gettext("Which configuration would you like to restore?") . "\n";
echo "Which configuration would you like to restore?\n";
echo " 1-" . count($confvers) . " : ";
$number = strtoupper(chop(fgets($fp)));
if (is_numeric($number) && ($number > 0) && ($number <= count($confvers))) {
return $number;
} else {
echo gettext("That is not a valid backup number.\n");
echo "That is not a valid backup number.\n";
return -1;
}
}
......@@ -65,45 +65,38 @@ function restore_history_backup($number)
global $fp, $confvers;
if (is_numeric($number) && ($number > 0) && ($number <= count($confvers))) {
echo "\n" . gettext("Is this the backup you wish to restore?") . "\n";
echo "\nIs this the backup you wish to restore?\n";
list_backups($number);
$filename = array_keys($confvers)[$number-1];
$thisbackup = $confvers[$filename];
echo gettext("Y/N?") . " : ";
echo 'Y/N? : ';
$confirm = strtoupper(chop(fgets($fp)));
if ($confirm == gettext("Y")) {
if ($confirm == 'Y') {
$cnf = OPNsense\Core\Config::getInstance();
if($cnf->restoreBackup($filename)){
echo "\n";
echo sprintf(gettext('Successfully reverted to timestamp %s with description "%s".'), date(gettext("n/j/y H:i:s"), $thisbackup['time']), $thisbackup['description']);
echo "\n" . gettext("You may need to reboot the firewall or restart services before the restored configuration is fully active.") . "\n\n";
echo sprintf('Successfully reverted to timestamp %s with description "%s".', date('n/j/y H:i:s', $thisbackup['time']), $thisbackup['description']);
echo "\nYou may need to reboot the firewall or restart services before the restored configuration is fully active.\n\n";
} else {
echo gettext("Unable to revert to the selected configuration.") . "\n";
echo "Unable to revert to the selected configuration.\n";
}
} else {
echo gettext("Restore canceled.") . "\n";
echo "Restore canceled.\n";
}
} else {
echo gettext("Restore canceled due to invalid input.") . "\n";
echo "Restore canceled due to invalid input.\n";
}
}
while (true) {
echo "\n";
echo gettext("Restore Backup from Configuration History") . "\n\n";
echo "1) " . gettext("List Backups") . "\n";
echo "2) " . gettext("Restore Backup") . "\n";
echo "Q) " . gettext("Quit") . "\n";
echo "\n\n";
echo gettext("Please select an option to continue") . ": ";
echo "\nRestore Backup from Configuration History\n\n";
echo "1) List Backups\n";
echo "2) Restore Backup\n";
echo "q) Quit\n\n\n";
echo "Please select an option to continue: ";
$command = strtolower(chop(fgets($fp)));
// Make sure we can detect a foreign language "quit" command.
if (strtolower($command) == gettext("quit"))
$command = "quit";
switch ($command) {
case "q":
case "quit":
......
......@@ -113,7 +113,7 @@ function prompt_for_enable_dhcp_server($version = 4)
$label_DHCP = ($version === 6) ? "DHCP6" : "DHCP";
$upperifname = strtoupper($interface);
return console_prompt_for_yn(sprintf(gettext("Do you want to enable the %s server on %s?"), $label_DHCP, $upperifname));
return console_prompt_for_yn(sprintf('Do you want to enable the %s server on %s?', $label_DHCP, $upperifname));
}
function get_interface_config_description($iface)
......@@ -270,7 +270,7 @@ function console_configure_ip_address($version)
$upperifname = strtoupper($interface);
if ($interface == "wan") {
if (console_prompt_for_yn(sprintf(gettext("Configure %s address %s interface via %s?"), $label_IPvX, $upperifname, $label_DHCP))) {
if (console_prompt_for_yn(sprintf('Configure %s address %s interface via %s?', $label_IPvX, $upperifname, $label_DHCP))) {
$ifppp = console_get_interface_from_ppp(get_real_interface("wan"));
if (!empty($ifppp)) {
$ifaceassigned = $ifppp;
......@@ -286,7 +286,7 @@ function console_configure_ip_address($version)
while (true) {
do {
echo "\n" . sprintf(
gettext("Enter the new %s %s address. Press <ENTER> for none:"),
'Enter the new %s %s address. Press <ENTER> for none:',
$upperifname,
$label_IPvX
) . "\n> ";
......@@ -294,13 +294,13 @@ function console_configure_ip_address($version)
$is_ipaddr = ($version === 6) ? is_ipaddrv6($intip) : is_ipaddrv4($intip);
if ($is_ipaddr && is_ipaddr_configured($intip, $interface)) {
$ip_conflict = true;
echo gettext("This IP address conflicts with another interface or a VIP") . "\n";
echo "This IP address conflicts with another interface or a VIP\n";
} else {
$ip_conflict = false;
}
} while (($ip_conflict === true) || !($is_ipaddr || $intip == ''));
if ($intip != '') {
echo "\n" . gettext("Subnet masks are entered as bit counts (like CIDR notation).") . "\n";
echo "\nSubnet masks are entered as bit counts (like CIDR notation).\n";
if ($version === 6) {
echo "e.g. ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00 = 120\n";
echo " ffff:ffff:ffff:ffff:ffff:ffff:ffff:0 = 112\n";
......@@ -315,7 +315,7 @@ function console_configure_ip_address($version)
do {
$upperifname = strtoupper($interface);
echo "\n" . sprintf(
gettext("Enter the new %s %s subnet bit count (1 to %s):"),
'Enter the new %s %s subnet bit count (1 to %s):',
$upperifname,
$label_IPvX,
$maxbits
......@@ -326,11 +326,11 @@ function console_configure_ip_address($version)
if ($version === 4 && $intbits < $maxbits) {
if ($intip == gen_subnet($intip, $intbits)) {
echo gettext("You cannot set network address to an interface");
echo 'You cannot set network address to an interface';
continue 2;
$intbits_ok = false;
} elseif ($intip == gen_subnet_max($intip, $intbits)) {
echo gettext("You cannot set broadcast address to an interface");
echo 'You cannot set broadcast address to an interface';
continue 2;
$intbits_ok = false;
}
......@@ -343,16 +343,16 @@ function console_configure_ip_address($version)
$subnet = gen_subnet($intip, $intbits);
}
do {
echo "\n" . sprintf(gettext("For a WAN, enter the new %s %s upstream gateway address."), $upperifname, $label_IPvX) . "\n" .
gettext("For a LAN, press <ENTER> for none:") . "\n> ";
echo "\n" . sprintf('For a WAN, enter the new %s %s upstream gateway address.', $upperifname, $label_IPvX) . "\n" .
'For a LAN, press <ENTER> for none:' . "\n> ";
$gwip = chop(fgets($fp));
$is_ipaddr = ($version === 6) ? is_ipaddrv6($gwip) : is_ipaddrv4($gwip);
$is_in_subnet = $is_ipaddr && ip_in_subnet($gwip, $subnet . "/" . $intbits);
if ($gwip != '') {
if (!$is_ipaddr) {
echo sprintf(gettext("not an %s IP address!"), $label_IPvX) . "\n";
echo sprintf('not an %s IP address!', $label_IPvX) . "\n";
} elseif (!$is_in_subnet) {
echo gettext("not in subnet!") . "\n";
echo "not in subnet\n";
}
}
} while (!($gwip == '' || ($is_ipaddr && $is_in_subnet)));
......@@ -399,7 +399,7 @@ function console_configure_dhcpd($version = 4)
$subnet_end = ($version === 6) ? gen_subnetv6_max($intip6, $intbits6) : gen_subnet_max($intip, $intbits);
do {
do {
echo sprintf(gettext("Enter the start address of the %s client address range:"), $label_IPvX) . " ";
echo sprintf('Enter the start address of the %s client address range:', $label_IPvX) . " ";
$dhcpstartip = chop(fgets($fp));
if ($dhcpstartip === "") {
fclose($fp);
......@@ -408,12 +408,12 @@ function console_configure_dhcpd($version = 4)
$is_ipaddr = ($version === 6) ? is_ipaddrv6($dhcpstartip) : is_ipaddrv4($dhcpstartip);
$is_inrange = is_inrange($dhcpstartip, $subnet_start, $subnet_end);
if (!$is_inrange) {
echo gettext("This IP address must be in the interface's subnet") . "\n";
echo "This IP address must be in the interface's subnet\n";
}
} while (!$is_ipaddr || !$is_inrange);
do {
echo sprintf(gettext("Enter the end address of the %s client address range:"), $label_IPvX) . " ";
echo sprintf('Enter the end address of the %s client address range:', $label_IPvX) . " ";
$dhcpendip = chop(fgets($fp));
if ($dhcpendip === "") {
fclose($fp);
......@@ -422,11 +422,11 @@ function console_configure_dhcpd($version = 4)
$is_ipaddr = ($version === 6) ? is_ipaddrv6($dhcpendip) : is_ipaddrv4($dhcpendip);
$is_inrange = is_inrange($dhcpendip, $subnet_start, $subnet_end);
if (!$is_inrange) {
echo gettext("This IP address must be in the interface's subnet") . "\n";
echo "This IP address must be in the interface's subnet\n";
}
$not_inorder = ($version === 6) ? (inet_pton($dhcpendip) < inet_pton($dhcpstartip)) : ip_less_than($dhcpendip, $dhcpstartip);
if ($not_inorder) {
echo gettext("The end address of the DHCP range must be >= the start address") . "\n";
echo "The end address of the DHCP range must be >= the start address\n";
}
} while (!$is_ipaddr || !$is_inrange);
} while ($not_inorder);
......@@ -437,7 +437,7 @@ function console_configure_dhcpd($version = 4)
} else {
if (isset($config[$dhcpd][$interface]['enable'])) {
unset($config[$dhcpd][$interface]['enable']);
printf(gettext("Disabling %s DHCPD..."), $label_IPvX);
printf('Disabling %s DHCPD...', $label_IPvX);
$restart_dhcpd = true;
}
}
......@@ -449,14 +449,14 @@ console_configure_dhcpd(6);
//*****************************************************************************
if ($config['system']['webgui']['protocol'] == "https") {
if (console_prompt_for_yn(gettext("Do you want to revert to HTTP as the web GUI protocol?"))) {
if (console_prompt_for_yn('Do you want to revert to HTTP as the web GUI protocol?')) {
$config['system']['webgui']['protocol'] = "http";
$restart_webgui = true;
}
}
if (isset($config['system']['webgui']['noantilockout'])) {
echo "\n" . sprintf(gettext("Note: the anti-lockout rule on %s has been re-enabled."), $interface) . "\n";
echo "\n" . sprintf('Note: the anti-lockout rule on %s has been re-enabled.', $interface) . "\n";
unset($config['system']['webgui']['noantilockout']);
}
......@@ -507,13 +507,13 @@ if (!$dry_run) {
if ($intip != '') {
if (is_ipaddr($intip)) {
echo "\n\n" . sprintf(
gettext("The IPv4 %s address has been set to %s"),
'The IPv4 %s address has been set to %s',
$upperifname,
"{$intip}/{$intbits}"
) . "\n";
} else {
echo "\n\n" . sprintf(
gettext("The IPv4 %s address has been set to %s"),
'The IPv4 %s address has been set to %s',
$upperifname,
$intip
) . "\n";
......@@ -522,13 +522,13 @@ if ($intip != '') {
if ($intip6 != '') {
if (is_ipaddr($intip6)) {
echo "\n\n" . sprintf(
gettext("The IPv6 %s address has been set to %s"),
'The IPv6 %s address has been set to %s',
$upperifname,
"${intip6}/${intbits6}"
) . "\n";
} else {
echo "\n\n" . sprintf(
gettext("The IPv6 %s address has been set to %s"),
'The IPv6 %s address has been set to %s',
$upperifname,
$intip6
) . "\n";
......@@ -537,7 +537,7 @@ if ($intip6 != '') {
if ($intip != '' || $intip6 != '') {
if (count($ifdescrs) == "1" or $interface == "lan") {
echo gettext('You can now access the web GUI by opening the following URL in your web browser:') . "\n";
echo "You can now access the web GUI by opening the following URL in your web browser:\n";
if (!empty($config['system']['webgui']['port'])) {
$webuiport = $config['system']['webgui']['port'];
if ($intip != '') {
......@@ -565,7 +565,7 @@ if ($intip != '' || $intip6 != '') {
}
}
echo "\n" . gettext('Press <ENTER> to continue.');
echo "\nPress <ENTER> to continue.";
fgets($fp);
fclose($fp);
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