diff options
-rw-r--r-- | drakpxelinux.pl | 74 | ||||
-rw-r--r-- | po/Makefile | 45 |
2 files changed, 83 insertions, 36 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl index 498374c..57f95fb 100644 --- a/drakpxelinux.pl +++ b/drakpxelinux.pl @@ -31,6 +31,9 @@ use MDK::Common; use ugtk2 qw(:ask :helpers :wrappers :create :dialogs); use interactive; +# i18n: IMPORTANT: to get correct namespace (drakconf instead of libDrakX) +BEGIN { unshift @::textdomains, 'drakpxelinux' } + use constant FALSE => 0; use constant TRUE => 1; @@ -58,19 +61,19 @@ my $interface = 'eth0'; my ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m; my $DOMAINNAME = chomp_(`dnsdomainname`); -my $help = " -PXE Label: the name displayed in PXE menu (a word/number) -Server: IP address of server, which contains installation directory -Kernel: memdisk or vmlinuz -Initrd: network boot image (network.img ) or all.rdz -Interface: network interface used for the installation process -Network: DHCP or an IP address -Directory: full path to MDK install server directory -Method: installation method: choose NFS or HTTP -Ramsize: ramsize parameter on boot disk -Display: export display on another computer (ie: 10.0.1.33:0) -VGA: if you encounter any problem with VGA, please adjust -"; +my $help = "" . +N("PXE Label: ") . N("the name displayed in PXE menu (a word/number)") . "\n" . +N("Server: ") . N("IP address of server, which contains installation directory") . "\n" . +N("Kernel: ") . N("memdisk or vmlinuz") . "\n" . +N("Initrd: ") . N("network boot image (network.img ) or all.rdz") . "\n" . +N("Interface: ") . N("network interface used for the installation process") . "\n" . +N("Network: ") . N("DHCP or an IP address") . "\n" . +N("Directory: ") . N("full path to MDK install server directory") . "\n" . +N("Method: ") . N("installation method: choose NFS or HTTP") . "\n" . +N("Ramsize: ") . N("ramsize parameter on boot disk") . "\n" . +N("Display: ") . N("export display on another computer (ie: 10.0.1.33:0)") . "\n" . +N("VGA: ") . N("if you encounter any problem with VGA, please adjust") . "\n" . +""; my %help = ( @@ -100,7 +103,7 @@ sub set_help_tip { } if (!-f $conf) { - err_dialog(N("Error !"), N("missing $conf\n\nPlease install pxe package.")) and !$::testing && die; + err_dialog(N("Error!"), N("missing %s\n\nPlease install pxe package.",$conf)) and !$::testing && die; } else { save_config($conf); } @@ -266,7 +269,7 @@ label $a->{label} sub create_model { get_items(); - my $model = Gtk2::ListStore->new(("Glib::String") x13); + my $model = Gtk2::ListStore->new(("Glib::String")); foreach my $a (@listpxe) { my $iter = $model->append; $model->set($iter, @@ -310,27 +313,27 @@ sub wizard_add_entry { name => N("Add PXE entry"), pages => { welcome => { - name => N("Add an all.rdz boot image") . N("To boot through network, network computer need a boot image. Morever we need to name this image, so each boot image is related to a name in PXE menu. So user can choose wich image he wants to boot through PXE.") . "\n\n" . N("For technical reason, in case of multiple boot image, it's more simple to boot network computer through a kernel (vmlinuz), and provide one file with all drivers needed (in our case all.rdz).") , + name => N("Add an all.rdz boot image") . "\n" . N("To boot through network, network computer need a boot image. Morever we need to name this image, so each boot image is related to a name in PXE menu. So user can choose wich image he wants to boot through PXE.") . "\n\n" . N("For technical reason, in case of multiple boot image, it's more simple to boot network computer through a kernel (vmlinuz), and provide one file with all drivers needed (in our case all.rdz).") , next => 'addimg', }, addimg => { - name => N("At the end of this wizard, the all.rdz image and kernel vmlinuz will be copied into \n$IMGPATH.\n\nPXE menu list will be updated with this new entry"), + name => N("At the end of this wizard, the all.rdz image and kernel vmlinuz will be copied into \n%s.\n\nPXE menu list will be updated with this new entry",$IMGPATH), data => [ - { label => "PXE label:", val => \$WPXENAME, + { label => N("PXE label:"), val => \$WPXENAME, help => N("name displayed in PXE menu (please provide a word or a number, with no space)") }, - { label => "PXE information:", val => \$WINFO, + { label => N("PXE information:"), val => \$WINFO, help => N("PXE information is used to explain the rule of the boot image,\nie:\nMandrake 10 rescue disk\nMandrake cooker install via http") }, - { label => "Full path to all.rdz image source:", val => \$WALLRDZ, + { label => N("Full path to all.rdz image source:"), val => \$WALLRDZ, help => N("Provide the full path to all.rdz image source") }, - { label => "Full path to vmlinuz source:", val => \$WVMLINUZ, + { label => N("Full path to vmlinuz source:"), val => \$WVMLINUZ, help => N("Provide the full path to vmlinuz kernel source") }, ], complete => sub { if (any { /^$WPXENAME :/ } cat_($PXEHELP)) { - err_dialog(N("Error !"), N("Found a similar entry in PXE list labeled : $WPXENAME.\nChoose another label please")) and return 'addimg'; + err_dialog(N("Error!"), N("Found a similar entry in PXE list labeled: %s.\nChoose another label please",$WPXENAME)) and return 'addimg'; } if ($WPXENAME != /^\d+$/) { - err_dialog(N("Error !"), N("PXE label should be a name/number without space. Please adjust")) and return 'addimg'; + err_dialog(N("Error!"), N("PXE label should be a name/number without space. Please adjust")) and return 'addimg'; } }, next => 'endadd', @@ -426,7 +429,7 @@ sub test_similar_label { # err_dialog(N("hmm.."), N("You should provide a new label name.")) and return 0; # } els if (any { /^label\s$newlabel$/ } cat_($conf)) { - err_dialog(N("Error !"), N("Found a similar entry in PXE list labeled : $newlabel.\nChoose another label please")) and return 0; + err_dialog(N("Error!"), N("Found a similar entry in PXE list labeled: %s.\nChoose another label please",$newlabel)) and return 0; } else { return 1 }; } @@ -464,9 +467,9 @@ sub edit_box_item { $fd->ok_button->signal_connect(clicked => sub { my $file = $fd->get_filename; if ($test eq "dir") { - -d $file or err_dialog(N("Error !"), N("Should be a directory.")) and return; + -d $file or err_dialog(N("Error!"), N("Should be a directory.")) and return; } else { - -f $file or err_dialog(N("Error !"), N("Should be a file")) and return; + -f $file or err_dialog(N("Error!"), N("Should be a file")) and return; $file = "images/" . basename($file); } $data->set_text($file); @@ -491,7 +494,7 @@ sub edit_box_item { set_help_tip($initrd, 'initrd'); my $file_dialog = $fdwidget->($initrd, ""); - my $buttoninitrd = Gtk2::Button->new("Select initrd"); + my $buttoninitrd = Gtk2::Button->new(N("Select initrd")); $buttoninitrd->signal_connect(clicked => sub { $file_dialog->show }); # combo box to pop down automatic installation @@ -519,7 +522,7 @@ sub edit_box_item { set_help_tip($directory, 'directory'); my $file_dialogd = $fdwidget->($directory, "dir"); - my $buttondir = Gtk2::Button->new("Select directory"); + my $buttondir = Gtk2::Button->new(N("Select directory")); $buttondir->signal_connect(clicked => sub { $file_dialogd->show }); @@ -561,7 +564,7 @@ sub edit_box_item { ), 0, gtkadd(Gtk2::Frame->new(N("Boot image")), gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3), - 0, Gtk2::Label->new("Path are relative to $X86, file out of this directory\ncould not be downloaded via tftp, because tftp server is chrooted"), + 0, Gtk2::Label->new(N("Path are relative to %s, file out of this directory\ncould not be downloaded via tftp, because tftp server is chrooted",$X86), 0, $label_and_widgets->(N("Kernel"), $kernel, $buttonkernel), 0, $label_and_widgets->(N("Initrd"), $initrd, $buttoninitrd), ), @@ -804,10 +807,10 @@ sub wizard_pxe_server { summaryserver => { name => N("The wizard will now prepare all default files to set your PXE server"), data => [ - { label => N("TFTP directory: $TFTPDIR") }, - { label => N("Boot image path: $IMGPATH") }, - { label => N("PXE config file: $pxeconf") }, - { label => N("PXE help file: $PXEHELP") }, + { label => N("TFTP directory:") . "\t\t" . "$TFTPDIR" }, + { label => N("Boot image path:") . "\t\t" . "$IMGPATH" }, + { label => N("PXE config file:") . "\t\t" . "$pxeconf" }, + { label => N("PXE help file:") . "\t\t" . "$PXEHELP" }, ], post => \&do_it_pxe, no_back => 1, @@ -944,8 +947,7 @@ sub add_columns { # check if first launch if (! -f "$X86/drakwizard_pxe") { - info_dialog("Please confure a PXE server", "Its seems this is the first time you run this tool. -A wizard will apppear to configure your pxe server."); + info_dialog(N("Please configure a PXE server"), N("Its seems this is the first time you run this tool.\n") . ("A wizard will apppear to configure your pxe server.")); eval { wizard_pxe_server() }; my $err = $@; $::WizardWindow->destroy if defined $::WizardWindow; @@ -1027,7 +1029,7 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0), . "\n\n" . $err); } }), - 0, gtksignal_connect(set_help_tip(Gtk2::Button->new((N"Remove PXE entry")), 'removepxe'), clicked => sub { + 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Remove PXE entry")), 'removepxe'), clicked => sub { remove_item($model, $treeview); } ), 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Edit PXE entry")), 'editb'), clicked => sub { diff --git a/po/Makefile b/po/Makefile new file mode 100644 index 0000000..7ead00c --- /dev/null +++ b/po/Makefile @@ -0,0 +1,45 @@ +# Installation directories +localedir = $(PREFIX)/usr/share/locale + +PGOAL = drakpxelinux + +# perl files to search translatable strings in +PL_FILES = ../drakpxelinux.pl +# C-like files to search translatable strings in +#CFILES = ./placeholder.h + +POFILES = $(shell ls *.po) +MOFILES = $(POFILES:%.po=%.mo) +LANGS = $(POFILES:%.po=%) + +GOALS = $(PGOAL).pot $(MOFILES) + + +all: $(GOALS) + +%.mo: %.po + msgfmt -o $@ $< + +placeholder.h: + ./create_placeholder + +merge: $(PGOAL).pot + @for n in $(POFILES); do \ + echo "Merging $$n"; \ + msgmerge "$$n" $< > "$$n"t; \ + mv -f "$$n"t "$$n"; \ + done + +$(PGOAL).pot: $(CFILES) + perl_checker -q --generate-pot $(PGOAL).pot $(PL_FILES) + +install: all + for l in $(LANGS); do \ + install -d $(localedir)/$$l/LC_MESSAGES; \ + install -m 644 $$l.mo $(localedir)/$$l/LC_MESSAGES/$(PGOAL).mo; \ + done + +clean: + @rm -rf *~ *.mo $(MOFILES) + + |