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":
......
This diff is collapsed.
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