*
*/
-#include "libsmooth.h"
+#include <libsmooth.h>
#include <signal.h>
+// Translation
+#include <libintl.h>
+#define _(x) dgettext("setup", x)
+
+#include "setup.h"
+
extern FILE *flog;
extern char *mylog;
-extern char **ctr;
-
extern struct nic nics[];
extern struct knic knics[];
sprintf(dhcphostnamefield, "%s_DHCP_HOSTNAME", colour);
sprintf(dhcpforcemtufield, "%s_DHCP_FORCE_MTU", colour);
- sprintf(message, ctr[TR_INTERFACE], colour);
+ sprintf(message, _("Interface - %s"), colour);
newtCenteredWindow(44, (typeflag ? 18 : 12), message);
networkform = newtForm(NULL, NULL, 0);
- sprintf(message, ctr[TR_ENTER_THE_IP_ADDRESS_INFORMATION], colour);
+ sprintf(message, _("Enter the IP address information for the %s interface."), colour);
header = newtTextboxReflowed(1, 1, message, 42, 0, 0, 0);
newtFormAddComponent(networkform, header);
if (strcmp(temp, "STATIC") == 0) startstatictype = 1;
if (strcmp(temp, "DHCP") == 0) startdhcptype = 1;
if (strcmp(temp, "PPPOE") == 0) startpppoetype = 1;
- statictyperadio = newtRadiobutton(2, 4, ctr[TR_STATIC], startstatictype, NULL);
- dhcptyperadio = newtRadiobutton(2, 5, ctr[TR_DHCP], startdhcptype, statictyperadio);
- pppoetyperadio = newtRadiobutton(2, 6, ctr[TR_PPP_DIALUP], startpppoetype, dhcptyperadio);
+ statictyperadio = newtRadiobutton(2, 4, _("Static"), startstatictype, NULL);
+ dhcptyperadio = newtRadiobutton(2, 5, _("DHCP"), startdhcptype, statictyperadio);
+ pppoetyperadio = newtRadiobutton(2, 6, _("PPP DIALUP (PPPoE, modem, ATM ...)"),
+ startpppoetype, dhcptyperadio);
newtFormAddComponents(networkform, statictyperadio, dhcptyperadio,
pppoetyperadio, NULL);
newtComponentAddCallback(statictyperadio, networkdialogcallbacktype, NULL);
newtComponentAddCallback(dhcptyperadio, networkdialogcallbacktype, NULL);
newtComponentAddCallback(pppoetyperadio, networkdialogcallbacktype, NULL);
dhcphostnamelabel = newtTextbox(2, 8, 18, 1, 0);
- newtTextboxSetText(dhcphostnamelabel, ctr[TR_DHCP_HOSTNAME]);
+ newtTextboxSetText(dhcphostnamelabel, _("DHCP Hostname:"));
dhcpforcemtulabel = newtTextbox(2, 9, 18, 1, 0);
- newtTextboxSetText(dhcpforcemtulabel, ctr[TR_DHCP_FORCE_MTU]);
+ newtTextboxSetText(dhcpforcemtulabel, _("Force DHCP MTU:"));
strcpy(temp, defaultdhcphostname);
findkey(kv, dhcphostnamefield, temp);
dhcphostnameentry = newtEntry(20, 8, temp, 20, &dhcphostnameresult, 0);
}
/* Address */
addresslabel = newtTextbox(2, (typeflag ? 11 : 4) + 0, 18, 1, 0);
- newtTextboxSetText(addresslabel, ctr[TR_IP_ADDRESS_PROMPT]);
+ newtTextboxSetText(addresslabel, _("IP address:"));
strcpy(temp, "");
findkey(kv, addressfield, temp);
addressentry = newtEntry(20, (typeflag ? 11 : 4) + 0, temp, 20, &addressresult, 0);
/* Netmask */
netmasklabel = newtTextbox(2, (typeflag ? 11 : 4) + 1, 18, 1, 0);
- newtTextboxSetText(netmasklabel, ctr[TR_NETMASK_PROMPT]);
+ newtTextboxSetText(netmasklabel, _("Network mask:"));
strcpy(temp, "255.255.255.0"); findkey(kv, netmaskfield, temp);
netmaskentry = newtEntry(20, (typeflag ? 11 : 4) + 1, temp, 20, &netmaskresult, 0);
newtEntrySetFilter(netmaskentry, ip_input_filter, NULL);
newtFormAddComponent(networkform, netmaskentry);
/* Buttons. */
- ok = newtButton(8, (typeflag ? 14 : 7), ctr[TR_OK]);
- cancel = newtButton(26, (typeflag ? 14 : 7), ctr[TR_CANCEL]);
+ ok = newtButton(8, (typeflag ? 14 : 7), _("OK"));
+ cancel = newtButton(26, (typeflag ? 14 : 7), _("Cancel"));
newtFormAddComponents(networkform, ok, cancel, NULL);
if (es.u.co == ok)
{
/* OK was pressed; verify the contents of each entry. */
- strcpy(message, ctr[TR_INVALID_FIELDS]);
+ strcpy(message, _("The following fields are invalid:"));
+ strcat(message, "\n\n");
strcpy(type, "STATIC");
if (typeflag)
{
if (inet_addr(addressresult) == INADDR_NONE)
{
- strcat(message, ctr[TR_IP_ADDRESS_CR]);
+ strcat(message, _("IP address"));
+ strcat(message, "\n");
error = 1;
}
if (inet_addr(netmaskresult) == INADDR_NONE)
{
- strcat(message, ctr[TR_NETWORK_MASK_CR]);
+ strcat(message, _("Network mask"));
+ strcat(message, "\n");
error = 1;
}
}
{
if (!strlen(dhcphostnameresult))
{
- strcat(message, ctr[TR_DHCP_HOSTNAME_CR]);
+ strcat(message, _("DHCP hostname"));
+ strcat(message, "\n");
error = 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(knics[ card ].driver, temp);
ret_value = 1;
} else {
- strcpy(knics[ card ].description, ctr[TR_UNSET]);
+ strcpy(knics[ card ].description, _("Unset"));
ret_value = 0;
}
freekeyvalues(kv);
char temp[STRING_SIZE];
sprintf(temp,"ip link show dev %s | grep -q UP", card);
- if (mysystem(temp)) return 0; else return 1;
+ if (mysystem(NULL, temp)) return 0; else return 1;
}
int rename_device(char *old_name, char *new_name) {
return 0;
}
sprintf(temp,"/sbin/ip link set dev %s name %s",old_name ,new_name );
- mysystem(temp);
+ mysystem(NULL, temp);
return 1;
}
char temp[STRING_SIZE];
sprintf(temp,"ip link set %s down", nic);
- mysystem(temp);
+ mysystem(NULL, temp);
}
int nic_startup(char *nic) {
char temp[STRING_SIZE];
sprintf(temp,"ip link set %s up", nic);
- mysystem(temp);
+ mysystem(NULL, temp);
}
}
}
-int create_udev(void)
-{
- #define UDEV_NET_CONF "/etc/udev/rules.d/30-persistent-network.rules"
- FILE *fp;
- int i;
-
- if ( (fp = fopen(UDEV_NET_CONF, "w")) == NULL ) {
- fprintf(stderr,"Couldn't open" UDEV_NET_CONF);
- return 1;
- }
-
- for (i = 0 ; i < 4 ; i++)
- {
- if (strcmp(knics[i].macaddr, "")) {
- fprintf(fp,"\n# %s\nACTION==\"add\", SUBSYSTEM==\"net\", ATTR{type}==\"1\", ATTR{address}==\"%s\", NAME=\"%s0\"\n", knics[i].description, knics[i].macaddr, lcolourcard[i]);
- }
- }
- fclose(fp);
- return 0;
-}
-
int write_configs_netudev(int card , int colour)
{
char commandstring[STRING_SIZE];
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 (!(scanned_nics_read_done))
{
- mysystem("/bin/probenic.sh");
+ mysystem(NULL, "/usr/bin/probenic.sh");
if( (fp = fopen(SCANNED_NICS, "r")) == NULL )
{
fprintf(stderr,"Couldn't open "SCANNED_NICS);
pMenuInhalt[mcount] = NULL;
- sprintf(message, ctr[TR_CHOOSE_NETCARD], ucolourcard[colour]);
+ sprintf(message, _("Please choose a networkcard for the following interface - %s."), ucolourcard[colour]);
rc=2;
while ( rc == 2 ) {
- rc = newtWinMenu( ctr[TR_NETCARDMENU2], message, 50, 5, 5, 6, pMenuInhalt, &choise, ctr[TR_SELECT], ctr[TR_IDENTIFY], ctr[TR_CANCEL], NULL);
+ rc = newtWinMenu(_("Extended Network Menu"), message, 50, 5, 5, 6, pMenuInhalt, &choise,
+ _("Select"), _("Identify"), _("Cancel"), NULL);
if ( rc == 2 ) {
sprintf(temp, "/sbin/ip link set %s up", nics[found_NIC_as_Card[choise]].nic);
- mysystem(temp);
+ mysystem(NULL, temp);
sprintf(temp, "/usr/sbin/ethtool -p %s 10", nics[found_NIC_as_Card[choise]].nic);
- if (runcommandwithstatus(temp,ctr[TR_IDENTIFY_SHOULD_BLINK]) != 0) {
- errorbox(ctr[TR_IDENTIFY_NOT_SUPPORTED]);
+ if (runcommandwithstatus(temp, _("Device Identification"), _("The lights on the selected port should flash now for 10 seconds..."), NULL) != 0) {
+ errorbox(_("Identification is not supported by this interface."));
sprintf(temp, "/sbin/ip link set %s down", nics[found_NIC_as_Card[choise]].nic);
- mysystem(temp);
+ mysystem(NULL, temp);
}
}
}
return 0;
} else {
// We have to add here that you can manually add a device
- errorbox( ctr[TR_ERROR_INTERFACES]);
+ errorbox(_("There are no unassigned interfaces on your system."));
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(knics[card].driver, "");
- strcpy(knics[card].description, ctr[TR_UNSET]);
+ strcpy(knics[card].description, _("Unset"));
strcpy(knics[card].macaddr, "");
strcpy(knics[card].colour, "");
sprintf(temp, "%s_DRIVER", ucolourcard[card]);
char message[STRING_SIZE];
int rc;
- sprintf(message, ctr[TR_REMOVE_CARD], ucolourcard[card]);
- rc = newtWinChoice(ctr[TR_WARNING], ctr[TR_OK], ctr[TR_CANCEL], message);
+ sprintf(message, _("Do you really want to remove the assigned %s interface?"), ucolourcard[card]);
+ rc = newtWinChoice(_("Warning"), _("OK"), _("Cancel"), message);
if ( rc = 0 || rc == 1) {
clear_card_entry(card);
strcpy(driver, "");
strcpy(driveroptions, "");
- rc = newtWinEntries(ctr[TR_SELECT_NETWORK_DRIVER],
- ctr[TR_MODULE_PARAMETERS], 50, 5, 5, 40, entries,
- ctr[TR_OK], ctr[TR_CANCEL], NULL);
+ rc = newtWinEntries(_("Select network driver"), _("Set additional module parameters"),
+ 50, 5, 5, 40, entries, _("OK"), _("Cancel"), NULL);
if (rc == 0 || rc == 1)
{
if (strlen(values[0]))
{
sprintf(commandstring, "/sbin/modprobe %s", values[0]);
- if (runcommandwithstatus(commandstring, ctr[TR_LOADING_MODULE]) == 0)
+ if (runcommandwithstatus(commandstring, _("Loading module..."), _("Loading module..."), NULL) == 0)
{
if ((driverend = strchr(values[0], ' ')))
{
}
}
else
- errorbox(ctr[TR_UNABLE_TO_LOAD_DRIVER_MODULE]);
+ errorbox(_("Unable to load driver module."));
}
else
- errorbox(ctr[TR_MODULE_NAME_CANNOT_BE_BLANK]);
+ errorbox(_("Module name cannot be blank."));
}
free(values[0]);