Changeset 2369


Ignore:
Timestamp:
Sep 5, 2016, 1:51:46 PM (3 years ago)
Author:
jrpelegrina
Message:

WIP in i18n support in nat-manager gui

Location:
n4d-network/trunk/fuentes
Files:
7 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • n4d-network/trunk/fuentes/n4d-nat-frontend.install/usr/share/n4d-nat-frontend/nat-manager.py

    r144 r2369  
     1import gi
     2gi.require_version('Gtk','3.0')
     3
    14from gi.repository import Gtk
    25import xmlrpclib
     
    811
    912signal.signal(signal.SIGINT, signal.SIG_DFL)
     13
     14import gettext
     15gettext.textdomain('n4d-nat-frontend')
     16_ = gettext.gettext
    1017
    1118class NatManager:
     
    2128                if not status:
    2229                        print("[!] You need root privileges to run this program [!]")
    23                         label = Gtk.Label("You need root privileges to run nat-manager")
     30                        label = Gtk.Label(_("You need root privileges to run nat-manager"))
    2431                        dialog = Gtk.Dialog("Warning", None, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT, (Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
    2532                        dialog.vbox.pack_start(label,True,True,10)
     
    6269                       
    6370                except Exception as e:
    64                         self.msg_label.set_text("N4D error: " + str(e))
     71                        self.msg_label.set_text(_("N4D error: ") + str(e))
    6572                        #set msg error
    6673               
     
    7279               
    7380                builder=Gtk.Builder()
    74                
     81                builder.set_translation_domain('n4d-nat-frontend')
    7582                if os.path.exists("/srv/svn/pandora/n4d-network/trunk/n4d-nat-frontend.install/usr/share/n4d-nat-frontend/rsrc/nat-manager.glade"):
    7683                        builder.add_from_file("/srv/svn/pandora/n4d-network/trunk/n4d-nat-frontend.install/usr/share/n4d-nat-frontend/rsrc/nat-manager.glade")
    7784                else:
    78                         builder.add_from_file("/usr/share/n4d-nat-frontend/rsrc/nat-manager.glade")
     85                        builder.add_from_file("/usr/share/n4d-nat-frontend/rsrc/nat-manager.ui")
    7986                       
    8087                self.window=builder.get_object("window")
     
    129136                        self.client.set_nat(self.key,"NetworkManager",self.status["nat"],self.status["nat_persistence"])
    130137                        self.client.set_routing(self.key,"NetworkManager",self.status["routing"],self.status["routing_persistence"])
    131                         self.msg_label.set_text("Changes saved successfuly")
     138                        self.msg_label.set_text(_("Changes saved successfuly"))
    132139                except Exception as e:
    133                         self.msg_label.set_text("Operation failed because: " + str(e))
     140                        self.msg_label.set_text(_("Operation failed because: ") + str(e))
    134141               
    135142               
Note: See TracChangeset for help on using the changeset viewer.