* The big one: networking.
*
*/
-
+
+// Translation
+#include <libintl.h>
+#define _(x) dgettext("setup", x)
+
#include "setup.h"
#define DNS1 0
extern FILE *flog;
extern char *mylog;
-extern char **ctr;
-
extern int automode;
#define HAS_GREEN 1
if (netaddresschange)
{
runcommandwithstatus("/etc/rc.d/init.d/network stop",
- ctr[TR_PUSHING_NETWORK_DOWN]);
+ _("Networking"), _("Stopping network..."), NULL);
rename_nics();
runcommandwithstatus("/etc/rc.d/init.d/network start",
- ctr[TR_PULLING_NETWORK_UP]);
+ _("Networking"), _("Restarting network..."), NULL);
}
} else {
rename_nics();
}
- create_udev();
return 1;
}
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
strcpy(temp, ""); findkey(kv, "GREEN_DEV", temp);
if (!(strlen(temp)))
{
- errorbox(ctr[TR_NO_GREEN_INTERFACE]);
+ errorbox(_("No GREEN interface assigned."));
freekeyvalues(kv);
return 0;
}
if (!(interfacecheck(kv, "GREEN")))
{
- errorbox(ctr[TR_MISSING_GREEN_IP]);
+ errorbox(_("Missing an IP address on GREEN."));
freekeyvalues(kv);
return 0;
}
strcpy(temp, ""); findkey(kv, "RED_DEV", temp);
if (!(strlen(temp)))
{
- rc = newtWinChoice(ctr[TR_ERROR], ctr[TR_OK], ctr[TR_IGNORE], ctr[TR_NO_RED_INTERFACE]);
+ rc = newtWinChoice(_("Error"), _("OK"), _("Ignore"),
+ _("No RED interface assigned."));
if (rc == 0 || rc == 1)
{
freekeyvalues(kv);
}
if (!(interfacecheck(kv, "RED")))
{
- errorbox(ctr[TR_MISSING_RED_IP]);
+ errorbox(_("Missing an IP address on RED."));
freekeyvalues(kv);
return 0;
}
strcpy(temp, ""); findkey(kv, "ORANGE_DEV", temp);
if (!(strlen(temp)))
{
- errorbox(ctr[TR_NO_ORANGE_INTERFACE]);
+ errorbox(_("No ORANGE interface assigned."));
freekeyvalues(kv);
return 0;
}
if (!(interfacecheck(kv, "ORANGE")))
{
- errorbox(ctr[TR_MISSING_ORANGE_IP]);
+ errorbox(_("Missing an IP address on ORANGE."));
freekeyvalues(kv);
return 0;
}
strcpy(temp, ""); findkey(kv, "BLUE_DEV", temp);
if (!(strlen(temp)))
{
- errorbox(ctr[TR_NO_BLUE_INTERFACE]);
+ errorbox(_("No BLUE interface assigned."));
freekeyvalues(kv);
return 0;
}
if (!(interfacecheck(kv, "BLUE")))
{
- errorbox(ctr[TR_MISSING_BLUE_IP]);
+ errorbox(_("Missing an IP address on BLUE."));
freekeyvalues(kv);
return 0;
}
strcpy(temp, ""); findkey(kv, "DNS1", temp);
if (!(strlen(temp)))
{
- errorbox(ctr[TR_MISSING_DNS]);
+ errorbox(_("Misssing DNS."));
freekeyvalues(kv);
return 0;
}
strcpy(temp, ""); findkey(kv, "DEFAULT_GATEWAY", temp);
if (!(strlen(temp)))
{
- errorbox(ctr[TR_MISSING_DEFAULT]);
+ errorbox(_("Missing Default Gateway."));
freekeyvalues(kv);
return 0;
}
/* Shows the main menu and a summary of the current settings. */
int firstmenu(void)
{
- char *sections[] = { ctr[TR_NETWORK_CONFIGURATION_TYPE],
- ctr[TR_DRIVERS_AND_CARD_ASSIGNMENTS],
- ctr[TR_ADDRESS_SETTINGS],
- ctr[TR_DNS_AND_GATEWAY_SETTINGS], NULL };
+ char *sections[] = {
+ _("Network configuration type"),
+ _("Drivers and card assignments"),
+ _("Address settings"),
+ _("DNS and Gateway settings"),
+ NULL
+ };
int rc;
static int choice = 0;
struct keyvalue *kv = initkeyvalues();
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
if (netaddresschange)
- strcpy(networkrestart, ctr[TR_RESTART_REQUIRED]);
+ strcpy(networkrestart, _("When configuration is complete, a network restart will be required."));
strcpy(temp, ""); findkey(kv, "CONFIG_TYPE", temp);
x = atol(temp);
x--;
if (x < 0 || x > 4) x = 0;
/* Format heading bit. */
- snprintf(message, 1000, ctr[TR_CURRENT_CONFIG], configtypenames[x],
- networkrestart);
- rc = newtWinMenu(ctr[TR_NETWORK_CONFIGURATION_MENU], message, 50, 5, 5, 6,
- sections, &choice, ctr[TR_OK], ctr[TR_DONE], NULL);
+ snprintf(message, 1000, _("Current config: %s\n\n%s"), configtypenames[x], networkrestart);
+ rc = newtWinMenu(_("Network configuration menu"), message, 50, 5, 5, 6,
+ sections, &choice, _("OK"), _("Done"), NULL);
if (rc == 0 || rc == 1)
result = choice + 1;
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
findkey(kv, "CONFIG_TYPE", temp); choise = atol(temp);
choise--;
- sprintf(message, ctr[TR_NETWORK_CONFIGURATION_TYPE_LONG], NAME);
- rc = newtWinMenu(ctr[TR_NETWORK_CONFIGURATION_TYPE], message, 50, 5, 5,
- 6, configtypenames, &choise, ctr[TR_OK], ctr[TR_CANCEL], NULL);
+ sprintf(message, _("Select the network configuration for %s. "
+ "The following configuration types list those interfaces which have ethernet attached. "
+ "If you change this setting, a network restart will be required, and you will have to "
+ "reconfigure the network driver assignments."), NAME);
+ rc = newtWinMenu(_("Network configuration type"), message, 50, 5, 5,
+ 6, configtypenames, &choise, _("OK"), _("Cancel"), NULL);
if ( configtypecards[choise] > found ) {
- sprintf(message, ctr[TR_NOT_ENOUGH_INTERFACES] , configtypecards[choise], found);
+ sprintf(message, _("Not enough netcards for your choice.\n\nNeeded: %d - Available: %d\n"),
+ configtypecards[choise], found);
errorbox(message);
}
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
writekeyvalues(kv, CONFIG_ROOT "/ethernet/settings");
}
- strcpy(message, ctr[TR_CONFIGURE_NETWORK_DRIVERS]);
+ strcpy(message, _("Configure network drivers, and which interface each card is assigned to. "
+ "The current configuration is as follows:\n\n"));
kcount = 0;
neednics = 0;
if (HAS_GREEN) {
- sprintf(temp, "GREEN: %s\n", knics[_GREEN_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "GREEN", knics[_GREEN_CARD_].description);
strcat(message, temp);
if (strlen(knics[_GREEN_CARD_].macaddr) ) {
- sprintf(temp, "GREEN: (%s) %s green0\n", knics[_GREEN_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "GREEN", knics[_GREEN_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
}
if (HAS_RED) {
- sprintf(temp, "RED: %s\n", knics[_RED_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "RED", knics[_RED_CARD_].description);
strcat(message, temp);
if (strlen(knics[_RED_CARD_].macaddr) ) {
- sprintf(temp, "RED: (%s) %s red0\n", knics[_RED_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "RED", knics[_RED_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
}
if (HAS_ORANGE) {
- sprintf(temp, "ORANGE: %s\n", knics[_ORANGE_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "ORANGE", knics[_ORANGE_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_ORANGE_CARD_].macaddr) ) {
- sprintf(temp, "ORANGE: (%s) %s orange0\n", knics[_ORANGE_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "ORANGE", knics[_ORANGE_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
}
if (HAS_BLUE) {
- sprintf(temp, "BLUE: %s\n", knics[_BLUE_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "BLUE", knics[_BLUE_CARD_].description);
strcat(message, temp);
if (strlen(knics[_BLUE_CARD_].macaddr)) {
- sprintf(temp, "BLUE: (%s) %s blue0\n", knics[_BLUE_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "BLUE", knics[_BLUE_CARD_].macaddr);
strcat(message, temp);
}
neednics++;
if (neednics = kcount)
{
- strcat(message, ctr[TR_DO_YOU_WISH_TO_CHANGE_THESE_SETTINGS]);
- rc = newtWinChoice(ctr[TR_DRIVERS_AND_CARD_ASSIGNMENTS], ctr[TR_OK],
- ctr[TR_CANCEL], message);
+ strcat(message, "\n");
+ strcat(message, _("Do you wish to change these settings?"));
+ rc = newtWinChoice(_("Drivers and card assignments"), _("OK"),
+ _("Cancel"), message);
if (rc == 0 || rc == 1)
{
changedrivers();
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
if (automode == 0)
runcommandwithstatus("/etc/rc.d/init.d/network stop red blue orange",
- ctr[TR_PUSHING_NON_LOCAL_NETWORK_DOWN]);
+ _("Networking"), _("Restarting non-local network..."), NULL);
findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
if (configtype == 1)
do
{
count = 0;
- strcpy(message, ctr[TR_INTERFACE_CHANGE]);
+ strcpy(message, _("Please choose the interface you wish to change.\n\n"));
if (green) {
strcpy(MenuInhalt[count], "GREEN");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_GREEN_CARD_] = count;
- sprintf(temp, "GREEN: %s\n", knics[_GREEN_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "GREEN", knics[_GREEN_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_GREEN_CARD_].macaddr) ) {
- sprintf(temp, "GREEN: (%s) %s green0\n", knics[_GREEN_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "GREEN", knics[_GREEN_CARD_].macaddr);
strcat(message, temp);
}
count++;
strcpy(MenuInhalt[count], "RED");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_RED_CARD_] = count;
- sprintf(temp, "RED: %s\n", knics[_RED_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "RED", knics[_RED_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_RED_CARD_].macaddr) ) {
- sprintf(temp, "RED: (%s) %s red0\n", knics[_RED_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "RED", knics[_RED_CARD_].macaddr);
strcat(message, temp);
}
count++;
strcpy(MenuInhalt[count], "ORANGE");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_ORANGE_CARD_] = count;
- sprintf(temp, "ORANGE: %s\n", knics[_ORANGE_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "ORANGE", knics[_ORANGE_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_ORANGE_CARD_].macaddr) ) {
- sprintf(temp, "ORANGE: (%s) %s orange0\n", knics[_ORANGE_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "ORANGE", knics[_ORANGE_CARD_].macaddr);
strcat(message, temp);
}
count++;
strcpy(MenuInhalt[count], "BLUE");
pMenuInhalt[count] = MenuInhalt[count];
NicEntry[_BLUE_CARD_] = count;
- sprintf(temp, "BLUE: %s\n", knics[_BLUE_CARD_].description);
+ sprintf(temp, "%-6s: %s\n", "BLUE", knics[_BLUE_CARD_].description);
strcat(message, temp);
if ( strlen(knics[_BLUE_CARD_].macaddr) ) {
- sprintf(temp, "BLUE: (%s) %s blue0\n", knics[_BLUE_CARD_].macaddr, ctr[TR_AS]);
+ sprintf(temp, "%-6s: (%s)\n", "BLUE", knics[_BLUE_CARD_].macaddr);
strcat(message, temp);
}
count++;
}
pMenuInhalt[count] = NULL;
- rc = newtWinMenu( ctr[TR_NETCARD_COLOR], message, 70, 5, 5, 6, pMenuInhalt, &choise, ctr[TR_SELECT], ctr[TR_REMOVE], ctr[TR_DONE], NULL);
+ rc = newtWinMenu(_("Assigned Cards"), message, 70, 5, 5, 6, pMenuInhalt,
+ &choise, _("Select"), _("Remove"), _("Done"), NULL);
if ( rc == 0 || rc == 1) {
if ((green) && ( choise == NicEntry[0])) nicmenu(_GREEN_CARD_);
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
- sprintf(message, ctr[TR_WARNING_LONG], NAME);
- rc = newtWinChoice(ctr[TR_WARNING], ctr[TR_OK], ctr[TR_CANCEL], message);
+ sprintf(message, _("If you change this IP address, and you are logged in remotely, "
+ "your connection to the %s machine will be broken, and you will have to reconnect "
+ "on the new IP. This is a risky operation, and should only be attempted if you "
+ "have physical access to the machine, should something go wrong."), NAME);
+ rc = newtWinChoice(_("Warning"), _("OK"), _("Cancel"), message);
if (rc == 0 || rc == 1)
{
{
freekeyvalues(kv);
freekeyvalues(mainkv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
if (!(readkeyvalues(mainkv, CONFIG_ROOT "/main/settings")))
{
freekeyvalues(kv);
freekeyvalues(mainkv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
done = 0;
while (!done)
{
- rc = newtWinMenu(ctr[TR_ADDRESS_SETTINGS],
- ctr[TR_SELECT_THE_INTERFACE_YOU_WISH_TO_RECONFIGURE], 50, 5,
- 5, 6, sections, &choice, ctr[TR_OK], ctr[TR_DONE], NULL);
+ rc = newtWinMenu(_("Address settings"),
+ _("Select the interface you wish to reconfigure."), 50, 5,
+ 5, 6, sections, &choice, _("OK"), _("Done"), NULL);
if (rc == 0 || rc == 1)
{
if (strcmp(sections[choice], "GREEN") == 0)
{
findkey(kv, "GREEN_ADDRESS", oldgreenaddress);
- sprintf(message, ctr[TR_WARNING_LONG], NAME);
- rc = newtWinChoice(ctr[TR_WARNING], ctr[TR_OK], ctr[TR_CANCEL],
- message);
+ sprintf(message, _("If you change this IP address, and you are logged in remotely, "
+ "your connection to the %s machine will be broken, and you will have to reconnect "
+ "on the new IP. This is a risky operation, and should only be attempted if you "
+ "have physical access to the machine, should something go wrong."), NAME);
+ rc = newtWinChoice(_("Warning"), _("OK"), _("Cancel"), message);
if (rc == 0 || rc == 1)
{
if (changeaddress(kv, "GREEN", 0, ""))
if (!(readkeyvalues(kv, CONFIG_ROOT "/ethernet/settings")))
{
freekeyvalues(kv);
- errorbox(ctr[TR_UNABLE_TO_OPEN_SETTINGS_FILE]);
+ errorbox(_("Unable to open settings file"));
return 0;
}
- entries[DNS1].text = ctr[TR_PRIMARY_DNS];
+ entries[DNS1].text = _("Primary DNS:");
strcpy(temp, ""); findkey(kv, "DNS1", temp);
values[DNS1] = strdup(temp);
entries[DNS1].value = &values[DNS1];
entries[DNS1].flags = 0;
- entries[DNS2].text = ctr[TR_SECONDARY_DNS];
+ entries[DNS2].text = _("Secondary DNS:");
strcpy(temp, ""); findkey(kv, "DNS2", temp);
values[DNS2] = strdup(temp);
entries[DNS2].value = &values[DNS2];
entries[DNS2].flags = 0;
- entries[DEFAULT_GATEWAY].text = ctr[TR_DEFAULT_GATEWAY];
+ entries[DEFAULT_GATEWAY].text = _("Default gateway:");
strcpy(temp, ""); findkey(kv, "DEFAULT_GATEWAY", temp);
values[DEFAULT_GATEWAY] = strdup(temp);
entries[DEFAULT_GATEWAY].value = &values[DEFAULT_GATEWAY];
{
error = 0;
- rc = newtWinEntries(ctr[TR_DNS_AND_GATEWAY_SETTINGS],
- ctr[TR_DNS_AND_GATEWAY_SETTINGS_LONG], 50, 5, 5, 18, entries,
- ctr[TR_OK], ctr[TR_CANCEL], NULL);
+ rc = newtWinEntries(_("DNS and Gateway settings"),
+ _("Enter the DNS and gateway information. "
+ "These settings are used only with Static IP (and DHCP if DNS set) on the RED interface."),
+ 50, 5, 5, 18, entries, _("OK"), _("Cancel"), NULL);
if (rc == 0 || rc == 1)
{
- strcpy(message, ctr[TR_INVALID_FIELDS]);
+ strcpy(message, _("The following fields are invalid:"));
+ strcpy(message, "\n\n");
if (strlen(values[DNS1]))
{
if (inet_addr(values[DNS1]) == INADDR_NONE)
{
- strcat(message, ctr[TR_PRIMARY_DNS_CR]);
+ strcat(message, _("Primary DNS"));
+ strcat(message, "\n");
error = 1;
}
}
{
if (inet_addr(values[DNS2]) == INADDR_NONE)
{
- strcat(message, ctr[TR_SECONDARY_DNS_CR]);
+ strcat(message, _("Secondary DNS"));
+ strcat(message, "\n");
error = 1;
}
}
{
if (inet_addr(values[DEFAULT_GATEWAY]) == INADDR_NONE)
{
- strcat(message, ctr[TR_DEFAULT_GATEWAY_CR]);
+ strcat(message, _("Default gateway"));
+ strcat(message, "\n");
error = 1;
}
}
if (!strlen(values[DNS1]) && strlen(values[DNS2]))
{
- strcpy(message, ctr[TR_SECONDARY_WITHOUT_PRIMARY_DNS]);
+ strcpy(message, _("Secondary DNS specified without a Primary DNS"));
+ strcat(message, "\n");
error = 1;
}