1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-28 17:32:36 +01:00

Moved translations out of translations.py, re-designed l10n system a bit

This commit is contained in:
David Paleino
2011-10-18 23:33:23 +02:00
parent 278f20a264
commit 4928f9c683
15 changed files with 414 additions and 519 deletions

View File

@@ -33,6 +33,8 @@ from commands import getoutput
from itertools import repeat, chain, izip
from pipes import quote
from wicd.translations import _
# wicd imports
import wpath
@@ -71,6 +73,30 @@ _sudo_dict = {
KTSUSS: "ktsuss",
}
_status_dict = {
'aborted': _('Connection Cancelled'),
'association_failed': _('Connection failed: Could not contact the wireless access point.'),
'bad_pass': _('Connection Failed: Bad password'),
'configuring_interface': _('Configuring wireless interface...'),
'dhcp_failed': _('Connection Failed: Unable to Get IP Address'),
'done': _('Done connecting...'),
'failed': _('Connection Failed.'),
'flushing_routing_table': _('Flushing the routing table...'),
'generating_psk': _('Generating PSK...'),
'generating_wpa_config': _('Generating WPA configuration file...'),
'interface_down': _('Putting interface down...'),
'interface_up': _('Putting interface up...'),
'no_dhcp_offers': _('Connection Failed: No DHCP offers received.'),
'resetting_ip_address': _('Resetting IP address...'),
'running_dhcp': _('Obtaining IP address...'),
'setting_broadcast_address': _('Setting broadcast address...'),
'setting_static_dns': _('Setting static DNS servers...'),
'setting_static_ip': _('Setting static IP addresses...'),
'success': _('Connection successful.'),
'validating_authentication': _('Validating authentication...'),
'verifying_association': _('Verifying access point association...'),
}
class WicdError(Exception):
pass
@@ -167,7 +193,7 @@ def PromptToStartDaemon():
else:
msg = '--caption'
sudo_args = [sudo_prog, msg,
'Wicd needs to access your computer\'s network cards.',
_("Wicd needs to access your computer's network cards."),
daemonloc]
os.spawnvpe(os.P_WAIT, sudo_prog, sudo_args, os.environ)
return True

View File

@@ -53,6 +53,7 @@ from signal import SIGTERM
import misc
import wpath
from backend import BackendManager
from translations import _
if __name__ == '__main__':
wpath.chdir(__file__)
@@ -330,13 +331,13 @@ class ConnectThread(threading.Thread):
self.iface = iface
self.connecting_message = None
self.connecting_status = None
self.debug = debug
self.SetStatus('interface_down')
def run(self):
self.connect_result = "Failed"
self.connect_result = "failed"
try:
self._connect()
finally:
@@ -360,7 +361,7 @@ class ConnectThread(threading.Thread):
"""
self.lock.acquire()
try:
self.connecting_message = status
self.connecting_status = status
finally:
self.lock.release()
@@ -373,10 +374,10 @@ class ConnectThread(threading.Thread):
"""
self.lock.acquire()
try:
message = self.connecting_message
status = self.connecting_status
finally:
self.lock.release()
return message
return status
@abortable
def reset_ip_addresses(self, iface):
@@ -496,7 +497,7 @@ class ConnectThread(threading.Thread):
""" Sets the thread status to aborted. """
if self.abort_reason:
reason = self.abort_reason
self.connecting_message = reason
self.connecting_status = reason
self.is_aborted = True
self.connect_result = reason
self.is_connecting = False
@@ -910,7 +911,7 @@ class WirelessConnectThread(ConnectThread):
self.SetStatus('validating_authentication')
if not wiface.ValidateAuthentication(time.time()):
print "connect result is %s" % self.connect_result
if not self.connect_result or self.connect_result == 'Failed':
if not self.connect_result or self.connect_result == 'failed':
self.abort_connection('bad_pass')
# Set up gateway, IP address, and DNS servers.
@@ -932,7 +933,7 @@ class WirelessConnectThread(ConnectThread):
print 'Connecting thread exiting.'
if self.debug:
print "IP Address is: " + str(wiface.GetIP())
self.connect_result = "Success"
self.connect_result = "success"
self.is_connecting = False
@abortable
@@ -962,7 +963,7 @@ class WirelessConnectThread(ConnectThread):
iface.FlushRoutes()
if hasattr(iface, "StopWPA"):
iface.StopWPA()
self.abort_connection("association_failed")
self.abort_connection('association_failed')
else:
print 'not verifying'
@@ -1163,5 +1164,5 @@ class WiredConnectThread(ConnectThread):
if self.debug:
print "IP Address is: " + str(liface.GetIP())
self.connect_result = "Success"
self.connect_result = "success"
self.is_connecting = False

View File

@@ -55,195 +55,35 @@ def get_gettext():
_ = lang.gettext
return _
# Generated automatically on Mon, 11 Jul 2011 03:53:23 CDT
_ = get_gettext()
# language[] should contain only strings in encryption templates, which
# can't otherwise be translated, at least with the current templating
# scheme.
language = {}
language['resetting_ip_address'] = _('''Resetting IP address...''')
language['prefs_help'] = _('''Preferences dialog''')
language['no_dhcp_offers'] = _('''Connection Failed: No DHCP offers received.''')
language['more_help'] = _('''For more detailed help, consult the wicd-curses(8) man page.''')
language['bad_pass'] = _('''Connection Failed: Bad password''')
language['cannot_start_daemon'] = _('''Unable to connect to wicd daemon DBus interface. This typically means there was a problem starting the daemon. Check the wicd log for more information.''')
language['verifying_association'] = _('''Verifying access point association...''')
language['wired_always_on'] = _('''Always show wired interface''')
language['could_not_connect'] = _('''Could not connect to wicd's D-Bus interface. Check the wicd log for error messages.''')
language['path_to_pac_file'] = _('''Path to PAC File''')
language['always_switch_to_wired'] = _('''Always switch to wired connection when available''')
language['disconn_help'] = _('''Disconnect from all networks''')
language['wired_networks'] = _('''Wired Networks''')
language['backend_alert'] = _('''Changes to your backend won't occur until the daemon is restarted.''')
language['about_help'] = _('''Stop a network connection in progress''')
language['connecting'] = _('''Connecting''')
language['pre_disconnect_script'] = _('''Run pre-disconnect script''')
language['cannot_edit_scripts_1'] = _('''To avoid various complications, wicd-curses does not support directly editing the scripts. However, you can edit them manually. First, (as root)", open the "$A" config file, and look for the section labeled by the $B in question. In this case, this is:''')
language['cannot_edit_scripts_3'] = _('''You can also configure the wireless networks by looking for the "[<ESSID>]" field in the config file.''')
language['cannot_edit_scripts_2'] = _('''Once there, you can adjust (or add) the "beforescript", "afterscript", and "disconnectscript" variables as needed, to change the preconnect, postconnect, and disconnect scripts respectively. Note that you will be specifying the full path to the scripts - not the actual script contents. You will need to add/edit the script contents separately. Refer to the wicd manual page for more information.''')
language['scripts_need_pass'] = _('''You must enter your password to configure scripts''')
language['dns_domain'] = _('''DNS domain''')
language['aborted'] = _('''Connection Cancelled''')
language['scanning_stand_by'] = _('''Scanning networks... stand by...''')
language['password'] = _('''Password''')
language['no_daemon_tooltip'] = _('''Wicd daemon unreachable''')
language['use_static_dns'] = _('''Use Static DNS''')
language['setting_broadcast_address'] = _('''Setting broadcast address...''')
language['choose_wired_profile'] = _('''Select or create a wired profile to connect with''')
language['make_wired_profile'] = _('''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.''')
language['esc_to_cancel'] = _('''Press ESC to cancel''')
language['scanning'] = _('''Scanning''')
language['flushing_routing_table'] = _('''Flushing the routing table...''')
language['brought_to_you'] = _('''Brought to you by:''')
language['refresh_help'] = _('''Refresh network list''')
language['select_hidden_essid'] = _('''Select Hidden Network ESSID''')
language['ext_programs'] = _('''External Programs''')
language['connect'] = _('''Connect''')
language['help_help'] = _('''Display this help dialog''')
language['use_global_dns'] = _('''Use global DNS servers''')
language['enable_encryption'] = _('''This network requires encryption to be enabled.''')
language['use_last_used_profile'] = _('''Use last used profile on wired autoconnect''')
language['preferences'] = _('''Preferences''')
language['dhcp_failed'] = _('''Connection Failed: Unable to Get IP Address''')
language['setting_static_ip'] = _('''Setting static IP addresses...''')
language['connecting_to_daemon'] = _('''Connecting to daemon...''')
language['automatic_connect'] = _('''Automatically connect to this network''')
language['never_connect'] = _('Never connect to this network')
language['show_never_connect'] = _('Show never connect networks')
language['hide_never_connect'] = _('Hide never connect networks')
language['add_new_wired_profile'] = _('''Add a new wired profile''')
language['dhcp_client'] = _('''DHCP Client''')
language['display_type_dialog'] = _('''Use dBm to measure signal strength''')
language['global_settings'] = _('''Use these settings for all networks sharing this essid''')
language['config_help'] = _('''Configure Selected Network''')
language['use_debug_mode'] = _('''Enable debug mode''')
language['removing_old_connection'] = _('''Removing old connection...''')
language['no_sudo_prog'] = _('''Could not find a graphical sudo program. The script editor could not be launched. You'll have to edit scripts directly your configuration file.''')
language['wireless_networks'] = _('''Wireless Networks''')
language['configuring_wired'] = _('''Configuring preferences for wired profile "$A"''')
language['no_wireless_networks_found'] = _('''No wireless networks found.''')
language['madwifi_for_adhoc'] = _('''Check if using madwifi/atheros drivers''')
language['properties'] = _('''Properties''')
language['setting_encryption_info'] = _('''Setting encryption info''')
language['about'] = _('''About Wicd''')
language['ok'] = _('''OK''')
language['adhoc_help'] = _('''Set up Ad-hoc network''')
language['scripts_help'] = _('''Select scripts''')
language['invalid_address'] = _('''Invalid address in $A entry.''')
language['configuring_interface'] = _('''Configuring wireless interface...''')
language['generating_psk'] = _('''Generating PSK...''')
language['validating_authentication'] = _('''Validating authentication...''')
language['essid'] = _('''ESSID''')
language['anonymous_identity'] = _('''Anonymous Identity''')
language['wireless_interface'] = _('''Wireless Interface''')
language['hidden_network'] = _('''Hidden Network''')
language['key'] = _('''Key''')
language['wicd_curses'] = _('''Wicd Curses Interface''')
language['debugging'] = _('''Debugging''')
language['use_encryption'] = _('''Use Encryption''')
language['wpa_supplicant'] = _('''WPA Supplicant''')
language['global_dns_servers'] = _('''Global DNS servers''')
language['not_connected'] = _('''Not connected''')
language['done'] = _('''Done connecting...''')
language['cannot_connect_to_daemon'] = _('''Can't connect to the daemon, trying to start it automatically...''')
language['cancel'] = _('''Cancel''')
language['case_sensitive'] = _('''All controls are case sensitive''')
language['gateway'] = _('''Gateway''')
language['backend'] = _('''Backend''')
language['dbus_fail'] = _('''DBus failure! This is most likely caused by the wicd daemon stopping while wicd-curses is running. Please restart the daemon, and then restart wicd-curses.''')
language['terminated'] = _('''Terminated by user''')
language['wired_detect'] = _('''Wired Link Detection''')
language['add_new_profile'] = _('''Add a new profile''')
language['use_ics'] = _('''Activate Internet Connection Sharing''')
language['create_adhoc_network'] = _('''Create an Ad-Hoc Network''')
language['interface_up'] = _('''Putting interface up...''')
language['global_dns_not_enabled'] = _('''Global DNS has not been enabled in general preferences.''')
language['dns'] = _('''DNS''')
language['advanced_settings'] = _('''Advanced Settings''')
language['username'] = _('''Username''')
language['wicd_auto_config'] = _('''Automatic (recommended)''')
language['wired_network_found'] = _('''Wired connection detected''')
language['netmask'] = _('''Netmask''')
language['select_a_network'] = _('''Choose from the networks below:''')
language['connect_help'] = _('''Connect to selected network''')
language['no_delete_last_profile'] = _('''wicd-curses does not support deleting the last wired profile. Try renaming it ('F2')''')
language['gen_settings'] = _('''General Settings''')
language['connected_to_wireless'] = _('''Connected to $A at $B (IP: $C)''')
language['exception'] = _('''EXCEPTION! Please report this to the maintainer and file a bug report with the backtrace below:''')
language['configuring_wireless'] = _('''Configuring preferences for wireless network "$A" ($B)''')
language['generating_wpa_config'] = _('''Generating WPA configuration file...''')
language['search_domain'] = _('''Search domain''')
language['encrypt_info_missing'] = _('''Required encryption information is missing.''')
language['running_dhcp'] = _('''Obtaining IP address...''')
language['lost_dbus'] = _('''The wicd daemon has shut down. The UI will not function properly until it is restarted.''')
language['wired_network_instructions'] = _('''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.''')
language['setting_static_dns'] = _('''Setting static DNS servers...''')
language['auto_reconnect'] = _('''Automatically reconnect on connection loss''')
language['use_wep_encryption'] = _('''Use Encryption (WEP only)''')
language['wired_autoconnect_settings'] = _('''Wired Autoconnect Settings''')
language['before_script'] = _('''Run script before connect''')
language['always_use_wext'] = _('''You should almost always use wext as the WPA supplicant driver''')
language['network_interfaces'] = _('''Network Interfaces''')
language['use_default_profile'] = _('''Use default profile on wired autoconnect''')
language['scan'] = _('''Scan''')
language['ip'] = _('''IP''')
language['connected_to_wired'] = _('''Connected to wired network (IP: $A)''')
language['wpa_supplicant_driver'] = _('''WPA Supplicant Driver''')
language['access_cards'] = _('''Wicd needs to access your computer's network cards.''')
language['killswitch_enabled'] = _('''Wireless Kill Switch Enabled''')
language['hidden_network_essid'] = _('''Hidden Network ESSID''')
language['secured'] = _('''Secured''')
language['interface_down'] = _('''Putting interface down...''')
language['authentication'] = _('''Authentication''')
language['after_script'] = _('''Run script after connect''')
language['show_wired_list'] = _('''Prompt for profile on wired autoconnect''')
language['channel'] = _('''Channel''')
language['unsecured'] = _('''Unsecured''')
language['rename_wired_profile'] = _('''Rename wired profile''')
language['daemon_unavailable'] = _('''The wicd daemon is unavailable, so your request cannot be completed''')
language['stop_showing_chooser'] = _('''Stop Showing Autoconnect pop-up temporarily''')
language['scan_help'] = _('''Scan for hidden networks''')
language['use_static_ip'] = _('''Use Static IPs''')
language['raw_screen_arg'] = _('''use urwid's raw screen controller''')
language['route_flush'] = _('''Route Table Flushing''')
language['scripts'] = _('''Scripts''')
language['identity'] = _('''Identity''')
language['automatic_reconnection'] = _('''Automatic Reconnection''')
language['wired_interface'] = _('''Wired Interface''')
language['press_to_quit'] = _('''Press F8 or Q to quit.''')
language['default_wired'] = _('''Use as default profile (overwrites any previous default)''')
language['wired_network'] = _('''Wired Network''')
language['dns_server'] = _('''DNS server''')
language['notifications'] = _('''Notifications''')
language['display_notifications'] = _('''Display notifications about connection status''')
language['connection_established'] = _('''Connection established''')
language['disconnected'] = _('''Disconnected''')
language['establishing_connection'] = _('''Establishing connection...''')
language['association_failed'] = _('''Connection failed: Could not contact the wireless access point.''')
language['access_denied'] = _('''Unable to contact the Wicd daemon due to an access denied error from DBus. Please check that your user is in the $A group.''')
language['disconnecting_active'] = _('''Disconnecting active connections...''')
language['access_denied_wc'] = _('''ERROR: wicd-curses was denied access to the wicd daemon: please check that your user is in the "$A" group.''')
language['post_disconnect_script'] = _('''Run post-disconnect script''')
language['resume_script'] = _('''Resume script''')
language['suspend_script'] = _('''Suspend script''')
language['invalid_ip_address'] = _('''Invalid IP address entered.''')
language['verify_ap_dialog'] = _('''Ping static gateways after connecting to verify association''')
language['conn_info_wireless'] = _('''$A
$B
$C
$D
$E KB/s
$F KB/s''')
language['conn_info_wired'] = _('''$A
$B KB/s
$C KB/s''')
language['conn_info_wireless_labels'] = _('''Wireless
SSID:
Speed:
IP:
Strength:
RX:
TX:''')
language['conn_info_wired_labels'] = _('''Wired
IP:
RX:
TX:''')
language['switch_on_wifi'] = _('''Switch On Wi-Fi''')
language['switch_off_wifi'] = _('''Switch Off Wi-Fi''')
# FIXME: these were present in wicd 1.7.0, can't find where they are.
# Leaving here for future reference, they should be removed whenever
# possible.
#language['cannot_start_daemon'] = _('''Unable to connect to wicd daemon DBus interface. This typically means there was a problem starting the daemon. Check the wicd log for more information.''')
#language['backend_alert'] = _('''Changes to your backend won't occur until the daemon is restarted.''')
#language['about_help'] = _('''Stop a network connection in progress''')
#language['connect'] = _('''Connect''')
# from templates, dict populated with:
# grep -R "*" encryption/templates/ | tr " " "\n" | grep "^*" | sed -e "s/*//"| sort -u | tr [A-Z] [a-z]
language['authentication'] = _('Authentication')
language['domain'] = _('Domain')
language['identity'] = _('Identity')
language['key'] = _('Key')
language['passphrase'] = _('Passphrase')
language['password'] = _('Password')
language['path_to_ca_cert'] = _('Path to CA cert')
language['path_to_client_cert'] = _('Path to client cert')
language['path_to_pac_file'] = _('Path to PAC file')
language['preshared_key'] = _('Preshared key')
language['private_key'] = _('Private key')
language['private_key_password'] = _('Private key password')
language['username'] = _('Username')

View File

@@ -57,7 +57,7 @@ from wicd import wpath
from wicd import networking
from wicd import misc
from wicd import wnettools
from wicd.misc import noneToBlankString
from wicd.misc import noneToBlankString, _status_dict
from wicd.logfile import ManagedStdio
from wicd.configmanager import ConfigManager
@@ -1176,15 +1176,24 @@ class WirelessDaemon(dbus.service.Object):
return ip
@dbus.service.method('org.wicd.daemon.wireless')
def CheckWirelessConnectingMessage(self):
""" Returns the wireless interface's status message. """
if not self.wifi.connecting_thread == None:
def CheckWirelessConnectingStatus(self):
""" Returns the wireless interface's status code. """
if self.wifi.connecting_thread:
essid = self.wifi.connecting_thread.network["essid"]
stat = self.wifi.connecting_thread.GetStatus()
return essid, stat
else:
return False
@dbus.service.method('org.wicd.daemon.wireless')
def CheckWirelessConnectingMessage(self):
""" Returns the wireless interface's status message. """
if self.wifi.connecting_thread:
essid, stat = self.CheckWirelessConnectingStatus()
return essid, _status_dict[stat]
else:
return False
@dbus.service.method('org.wicd.daemon.wireless')
def ReadWirelessNetworkProfile(self, id):
""" Reads in wireless profile as the active network """
@@ -1372,11 +1381,19 @@ class WiredDaemon(dbus.service.Object):
else:
return False
@dbus.service.method('org.wicd.daemon.wired')
def CheckWiredConnectingStatus(self):
"""Returns the wired interface's status code. '"""
if self.wired.connecting_thread:
return self.wired.connecting_thread.GetStatus()
else:
return False
@dbus.service.method('org.wicd.daemon.wired')
def CheckWiredConnectingMessage(self):
""" Returns the wired interface's status message. """
if self.wired.connecting_thread:
return self.wired.connecting_thread.GetStatus()
return _status_dict(self.CheckWiredConnectingStatus())
else:
return False