mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +01:00
Moved translations out of translations.py, re-designed l10n system a bit
This commit is contained in:
@@ -32,7 +32,7 @@ import wicd.dbusmanager as dbusmanager
|
||||
from wicd.misc import noneToString, stringToNone, noneToBlankString, to_bool
|
||||
from guiutil import error, LabelEntry, GreyLabel, LeftAlignedLabel, string_input, ProtectedLabelEntry
|
||||
|
||||
from wicd.translations import language
|
||||
from wicd.translations import language, _
|
||||
|
||||
# These get set when a NetworkEntry is instantiated.
|
||||
daemon = None
|
||||
@@ -55,9 +55,9 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
"""
|
||||
# if no network name was passed, just use Properties as the title
|
||||
if network_name:
|
||||
title = '%s - %s' % (network_name, language['properties'])
|
||||
title = '%s - %s' % (network_name, _('Properties'))
|
||||
else:
|
||||
title = language['properties']
|
||||
title = _('Properties')
|
||||
|
||||
gtk.Dialog.__init__(self, title=title,
|
||||
flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_CANCEL,
|
||||
@@ -70,23 +70,23 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
self.connect('show', lambda *a, **k: self.set_default_size())
|
||||
|
||||
# Set up the Advanced Settings Dialog.
|
||||
self.txt_ip = LabelEntry(language['ip'])
|
||||
self.txt_ip = LabelEntry(_('IP'))
|
||||
self.txt_ip.entry.connect('focus-out-event', self.set_defaults)
|
||||
self.txt_netmask = LabelEntry(language['netmask'])
|
||||
self.txt_gateway = LabelEntry(language['gateway'])
|
||||
self.txt_search_dom = LabelEntry(language['search_domain'])
|
||||
self.txt_domain = LabelEntry(language['dns_domain'])
|
||||
self.txt_dns_1 = LabelEntry(language['dns'] + ' 1')
|
||||
self.txt_dns_2 = LabelEntry(language['dns'] + ' 2')
|
||||
self.txt_dns_3 = LabelEntry(language['dns'] + ' 3')
|
||||
self.txt_netmask = LabelEntry(_('Netmask'))
|
||||
self.txt_gateway = LabelEntry(_('Gateway'))
|
||||
self.txt_search_dom = LabelEntry(_('Search domain'))
|
||||
self.txt_domain = LabelEntry(_('DNS domain'))
|
||||
self.txt_dns_1 = LabelEntry(_('DNS server') + ' 1')
|
||||
self.txt_dns_2 = LabelEntry(_('DNS server') + ' 2')
|
||||
self.txt_dns_3 = LabelEntry(_('DNS server') + ' 3')
|
||||
dhcp_hostname_hbox = gtk.HBox(False, 0)
|
||||
self.chkbox_use_dhcp_hostname = gtk.CheckButton()
|
||||
self.txt_dhcp_hostname = LabelEntry("DHCP Hostname")
|
||||
dhcp_hostname_hbox.pack_start(self.chkbox_use_dhcp_hostname, fill=False, expand=False)
|
||||
dhcp_hostname_hbox.pack_start(self.txt_dhcp_hostname)
|
||||
self.chkbox_static_ip = gtk.CheckButton(language['use_static_ip'])
|
||||
self.chkbox_static_dns = gtk.CheckButton(language['use_static_dns'])
|
||||
self.chkbox_global_dns = gtk.CheckButton(language['use_global_dns'])
|
||||
self.chkbox_static_ip = gtk.CheckButton(_('Use Static IPs'))
|
||||
self.chkbox_static_dns = gtk.CheckButton(_('Use Static DNS'))
|
||||
self.chkbox_global_dns = gtk.CheckButton(_('Use global DNS servers'))
|
||||
self.hbox_dns = gtk.HBox(False, 0)
|
||||
self.hbox_dns.pack_start(self.chkbox_static_dns)
|
||||
self.hbox_dns.pack_start(self.chkbox_global_dns)
|
||||
@@ -98,7 +98,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
script_image.set_padding(4, 0)
|
||||
#self.script_button.set_alignment(.5, .5)
|
||||
self.script_button.set_image(script_image)
|
||||
self.script_button.set_label(language['scripts'])
|
||||
self.script_button.set_label(_('Scripts'))
|
||||
|
||||
self.button_hbox = gtk.HBox(False, 2)
|
||||
self.button_hbox.pack_start(self.script_button, fill=False, expand=False)
|
||||
@@ -163,7 +163,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
if stringToNone(netmask.get_text()) is None: # Make sure the netmask is blank
|
||||
netmask.set_text('255.255.255.0') # Fill in the most common one
|
||||
elif ipAddress != "":
|
||||
error(None, language['invalid_ip_address'])
|
||||
error(None, _('Invalid IP address entered.'))
|
||||
|
||||
def reset_static_checkboxes(self):
|
||||
# Enable the right stuff
|
||||
@@ -229,7 +229,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
""" Set the DNS entries' sensitivity based on the Global checkbox. """
|
||||
global_dns_active = daemon.GetUseGlobalDNS()
|
||||
if not global_dns_active and self.chkbox_global_dns.get_active():
|
||||
error(None, language['global_dns_not_enabled'])
|
||||
error(None, _('Global DNS has not been enabled in general preferences.'))
|
||||
self.chkbox_global_dns.set_active(False)
|
||||
if daemon.GetUseGlobalDNS() and self.chkbox_static_dns.get_active():
|
||||
for w in [self.txt_dns_1, self.txt_dns_2, self.txt_dns_3,
|
||||
@@ -282,7 +282,7 @@ class AdvancedSettingsDialog(gtk.Dialog):
|
||||
class WiredSettingsDialog(AdvancedSettingsDialog):
|
||||
def __init__(self, name):
|
||||
""" Build the wired settings dialog. """
|
||||
AdvancedSettingsDialog.__init__(self, language['wired_network'])
|
||||
AdvancedSettingsDialog.__init__(self, _('Wired Network'))
|
||||
self.des = self.connect("destroy", self.destroy_called)
|
||||
self.script_button.connect("clicked", self.edit_scripts)
|
||||
self.prof_name = name
|
||||
@@ -296,10 +296,12 @@ class WiredSettingsDialog(AdvancedSettingsDialog):
|
||||
profile = self.prof_name
|
||||
cmdend = [os.path.join(wpath.gtk, "configscript.py"), profile, "wired"]
|
||||
if os.getuid() != 0:
|
||||
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'],
|
||||
cmdbase = misc.get_sudo_cmd(_('You must enter your password to configure scripts'),
|
||||
prog_num=daemon.GetSudoApp())
|
||||
if not cmdbase:
|
||||
error(None, language["no_sudo_prog"])
|
||||
error(None, _('Could not find a graphical sudo program. '\
|
||||
'The script editor could not be launched. '\
|
||||
"You'll have to edit scripts directly your configuration file."))
|
||||
return
|
||||
cmdbase.extend(cmdend)
|
||||
misc.LaunchAndWait(cmdbase)
|
||||
@@ -350,8 +352,8 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
# Set up encryption stuff
|
||||
self.networkID = networkID
|
||||
self.combo_encryption = gtk.combo_box_new_text()
|
||||
self.chkbox_encryption = gtk.CheckButton(language['use_encryption'])
|
||||
self.chkbox_global_settings = gtk.CheckButton(language['global_settings'])
|
||||
self.chkbox_encryption = gtk.CheckButton(_('Use Encryption'))
|
||||
self.chkbox_global_settings = gtk.CheckButton(_('Use these settings for all networks sharing this essid'))
|
||||
# Make the vbox to hold the encryption stuff.
|
||||
self.vbox_encrypt_info = gtk.VBox(False, 0)
|
||||
self.toggle_encryption()
|
||||
@@ -402,10 +404,12 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
cmdend = [os.path.join(wpath.gtk, "configscript.py"),
|
||||
str(self.networkID), "wireless"]
|
||||
if os.getuid() != 0:
|
||||
cmdbase = misc.get_sudo_cmd(language['scripts_need_pass'],
|
||||
cmdbase = misc.get_sudo_cmd(_('You must enter your password to configure scripts'),
|
||||
prog_num=daemon.GetSudoApp())
|
||||
if not cmdbase:
|
||||
error(None, language["no_sudo_prog"])
|
||||
error(None, _('Could not find a graphical sudo program. '\
|
||||
'The script editor could not be launched. '\
|
||||
"You'll have to edit scripts directly your configuration file."))
|
||||
return
|
||||
cmdbase.extend(cmdend)
|
||||
misc.LaunchAndWait(cmdbase)
|
||||
@@ -478,7 +482,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
for entry_info in encrypt_info.itervalues():
|
||||
if entry_info[0].entry.get_text() == "" and \
|
||||
entry_info[1] == 'required':
|
||||
error(self, "%s (%s)" % (language['encrypt_info_missing'],
|
||||
error(self, "%s (%s)" % (_('Required encryption information is missing.'),
|
||||
entry_info[0].label.get_label())
|
||||
)
|
||||
return False
|
||||
@@ -489,7 +493,7 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
elif not self.chkbox_encryption.get_active() and \
|
||||
wireless.GetWirelessProperty(networkid, "encryption"):
|
||||
# Encrypt checkbox is off, but the network needs it.
|
||||
error(self, language['enable_encryption'])
|
||||
error(self, _('This network requires encryption to be enabled.'))
|
||||
return False
|
||||
else:
|
||||
print "no encryption specified..."
|
||||
@@ -531,11 +535,8 @@ class WirelessSettingsDialog(AdvancedSettingsDialog):
|
||||
for type_ in ['required', 'optional']:
|
||||
fields = methods[ID][type_]
|
||||
for field in fields:
|
||||
if language.has_key(field[1]):
|
||||
field_text = language[field[1].lower().replace(' ','_')]
|
||||
else:
|
||||
field_text = field[1].replace('_',' ')
|
||||
|
||||
field_text = language[field[1].lower().replace(' ','_')]
|
||||
|
||||
if field in methods[ID]['protected']:
|
||||
box = ProtectedLabelEntry(field_text)
|
||||
else:
|
||||
@@ -593,7 +594,7 @@ class NetworkEntry(gtk.HBox):
|
||||
self.advanced_image.set_from_stock(gtk.STOCK_EDIT, 4)
|
||||
self.advanced_image.set_padding(4, 0)
|
||||
self.advanced_button.set_alignment(.5, .5)
|
||||
self.advanced_button.set_label(language['properties'])
|
||||
self.advanced_button.set_label(_('Properties'))
|
||||
self.advanced_button.set_image(self.advanced_image)
|
||||
|
||||
self.buttons_hbox.pack_start(self.connect_hbox, False, False)
|
||||
@@ -624,14 +625,14 @@ class WiredNetworkEntry(NetworkEntry):
|
||||
self.connect_button.show()
|
||||
|
||||
self.name_label.set_use_markup(True)
|
||||
self.name_label.set_label("<b>" + language['wired_network'] + "</b>")
|
||||
self.name_label.set_label("<b>" + _('Wired Network') + "</b>")
|
||||
|
||||
self.is_full_gui = True
|
||||
|
||||
self.button_add = gtk.Button(stock=gtk.STOCK_ADD)
|
||||
self.button_delete = gtk.Button(stock=gtk.STOCK_DELETE)
|
||||
self.profile_help = gtk.Label(language['wired_network_instructions'])
|
||||
self.chkbox_default_profile = gtk.CheckButton(language['default_wired'])
|
||||
self.profile_help = gtk.Label(_('To connect to a wired network, you must create a network profile. To create a network profile, type a name that describes this network, and press Add.'))
|
||||
self.chkbox_default_profile = gtk.CheckButton(_('Use as default profile (overwrites any previous default)'))
|
||||
self.combo_profile_names = gtk.combo_box_new_text()
|
||||
|
||||
# Format the profile help label.
|
||||
@@ -812,8 +813,8 @@ class WirelessNetworkEntry(NetworkEntry):
|
||||
self.lbl_channel = GreyLabel()
|
||||
|
||||
print "ESSID : " + self.essid
|
||||
self.chkbox_autoconnect = gtk.CheckButton(language['automatic_connect'])
|
||||
self.chkbox_neverconnect = gtk.CheckButton(language['never_connect'])
|
||||
self.chkbox_autoconnect = gtk.CheckButton(_('Automatically connect to this network'))
|
||||
self.chkbox_neverconnect = gtk.CheckButton(_('Never connect to this network'))
|
||||
|
||||
self.set_signal_strength(wireless.GetWirelessProperty(networkID,
|
||||
'quality'),
|
||||
@@ -955,13 +956,13 @@ class WirelessNetworkEntry(NetworkEntry):
|
||||
if on and ttype:
|
||||
self.lbl_encryption.set_label(str(ttype))
|
||||
if on and not ttype:
|
||||
self.lbl_encryption.set_label(language['secured'])
|
||||
self.lbl_encryption.set_label(_('Secured'))
|
||||
if not on:
|
||||
self.lbl_encryption.set_label(language['unsecured'])
|
||||
self.lbl_encryption.set_label(_('Unsecured'))
|
||||
|
||||
def set_channel(self, channel):
|
||||
""" Set the channel value for the WirelessNetworkEntry. """
|
||||
self.lbl_channel.set_label(language['channel'] + ' ' + str(channel))
|
||||
self.lbl_channel.set_label(_('Channel') + ' ' + str(channel))
|
||||
|
||||
def format_entry(self, networkid, label):
|
||||
""" Helper method for fetching/formatting wireless properties. """
|
||||
@@ -1077,13 +1078,13 @@ class WirelessInformationDialog(gtk.Dialog):
|
||||
if on and ttype:
|
||||
self.lbl_encryption.set_label(str(ttype))
|
||||
if on and not ttype:
|
||||
self.lbl_encryption.set_label(language['secured'])
|
||||
self.lbl_encryption.set_label(_('Secured'))
|
||||
if not on:
|
||||
self.lbl_encryption.set_label(language['unsecured'])
|
||||
self.lbl_encryption.set_label(_('Unsecured'))
|
||||
|
||||
def set_channel(self, channel):
|
||||
""" Set the channel value for the WirelessNetworkEntry. """
|
||||
self.lbl_channel.set_label(language['channel'] + ' ' + str(channel))
|
||||
self.lbl_channel.set_label(_('Channel') + ' ' + str(channel))
|
||||
|
||||
def set_mode(self, mode):
|
||||
""" Set the mode value for the WirelessNetworkEntry. """
|
||||
|
||||
Reference in New Issue
Block a user