mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2026-11-20 03:02:40 +03:00
Merge pull request #1153 from EDCD/fix/1074/translations-full-phrases
Translations: General cleanup pass
This commit is contained in:
12 files changed
+715
-665
No files matched your search
@@ -66,6 +66,16 @@ repos:
|
||||
args: [check, --bare, -r]
|
||||
language: system
|
||||
|
||||
# Check translation comments are up to date
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: LANG_comments
|
||||
name: 'LANG comments'
|
||||
language: system
|
||||
entry: python scripts/find_localised_strings.py --compare-lang L10n/en.template --directory . --ignore coriolis-data --ignore dist.win32
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
|
||||
default_language_version:
|
||||
python: python3.9
|
||||
|
||||
|
||||
+43
-35
@@ -694,53 +694,54 @@ class AppWindow(object):
|
||||
|
||||
# (Re-)install log monitoring
|
||||
if not monitor.start(self.w):
|
||||
self.status['text'] = f'Error: {_("Check")} {_("E:D journal file location")}'
|
||||
# LANG: ED Journal file location appears to be in error
|
||||
self.status['text'] = _('Error: Check E:D journal file location')
|
||||
|
||||
if dologin and monitor.cmdr:
|
||||
self.login() # Login if not already logged in with this Cmdr
|
||||
|
||||
def set_labels(self):
|
||||
"""Set main window labels, e.g. after language change."""
|
||||
self.cmdr_label['text'] = _('Cmdr') + ':' # LANG: Main window
|
||||
# Multicrew role label in main window
|
||||
self.cmdr_label['text'] = _('Cmdr') + ':' # LANG: Label for commander name in main window
|
||||
# LANG: 'Ship' or multi-crew role label in main window, as applicable
|
||||
self.ship_label['text'] = (monitor.state['Captain'] and _('Role') or _('Ship')) + ':' # Main window
|
||||
self.suit_label['text'] = _('Suit') + ':' # LANG: Main window
|
||||
self.system_label['text'] = _('System') + ':' # LANG: Main window
|
||||
self.station_label['text'] = _('Station') + ':' # LANG: Main window
|
||||
self.suit_label['text'] = _('Suit') + ':' # LANG: Label for 'Suit' line in main UI
|
||||
self.system_label['text'] = _('System') + ':' # LANG: Label for 'System' line in main UI
|
||||
self.station_label['text'] = _('Station') + ':' # LANG: Label for 'Station' line in main UI
|
||||
self.button['text'] = self.theme_button['text'] = _('Update') # LANG: Update button in main window
|
||||
if platform == 'darwin':
|
||||
self.menubar.entryconfigure(1, label=_('File')) # LANG: Menu title on OSX
|
||||
self.menubar.entryconfigure(2, label=_('Edit')) # LANG: Menu title on OSX
|
||||
self.menubar.entryconfigure(3, label=_('View')) # LANG: Menu title on OSX
|
||||
self.menubar.entryconfigure(4, label=_('Window')) # LANG: Menu title on OSX
|
||||
self.menubar.entryconfigure(5, label=_('Help')) # LANG: Menu title on OSX
|
||||
self.menubar.entryconfigure(1, label=_('File')) # LANG: 'File' menu title on OSX
|
||||
self.menubar.entryconfigure(2, label=_('Edit')) # LANG: 'Edit' menu title on OSX
|
||||
self.menubar.entryconfigure(3, label=_('View')) # LANG: 'View' menu title on OSX
|
||||
self.menubar.entryconfigure(4, label=_('Window')) # LANG: 'Window' menu title on OSX
|
||||
self.menubar.entryconfigure(5, label=_('Help')) # LANG: Help' menu title on OSX
|
||||
self.system_menu.entryconfigure(0, label=_("About {APP}").format(
|
||||
APP=applongname)) # LANG: App menu entry on OSX
|
||||
self.system_menu.entryconfigure(1, label=_("Check for Updates...")) # LANG: Menu item
|
||||
self.file_menu.entryconfigure(0, label=_('Save Raw Data...')) # LANG: Menu item
|
||||
self.view_menu.entryconfigure(0, label=_('Status')) # LANG: Menu item
|
||||
self.help_menu.entryconfigure(1, label=_('Privacy Policy')) # LANG: Help menu item
|
||||
self.help_menu.entryconfigure(2, label=_('Release Notes')) # LANG: Help menu item
|
||||
self.system_menu.entryconfigure(1, label=_("Check for Updates...")) # LANG: Help > Check for Updates
|
||||
self.file_menu.entryconfigure(0, label=_('Save Raw Data...')) # LANG: File > Save Raw Data...
|
||||
self.view_menu.entryconfigure(0, label=_('Status')) # LANG: File > Status
|
||||
self.help_menu.entryconfigure(1, label=_('Privacy Policy')) # LANG: Help > Privacy Policy
|
||||
self.help_menu.entryconfigure(2, label=_('Release Notes')) # LANG: Help > Release Notes
|
||||
else:
|
||||
self.menubar.entryconfigure(1, label=_('File')) # LANG: Menu title
|
||||
self.menubar.entryconfigure(2, label=_('Edit')) # LANG: Menu title
|
||||
self.menubar.entryconfigure(3, label=_('Help')) # LANG: Menu title
|
||||
self.theme_file_menu['text'] = _('File') # LANG: Menu title
|
||||
self.theme_edit_menu['text'] = _('Edit') # LANG: Menu title
|
||||
self.theme_help_menu['text'] = _('Help') # LANG: Menu title
|
||||
self.menubar.entryconfigure(1, label=_('File')) # LANG: 'File' menu title
|
||||
self.menubar.entryconfigure(2, label=_('Edit')) # LANG: 'Edit' menu title
|
||||
self.menubar.entryconfigure(3, label=_('Help')) # LANG: 'Help' menu title
|
||||
self.theme_file_menu['text'] = _('File') # LANG: 'File' menu title
|
||||
self.theme_edit_menu['text'] = _('Edit') # LANG: 'Edit' menu title
|
||||
self.theme_help_menu['text'] = _('Help') # LANG: 'Help' menu title
|
||||
|
||||
# File menu
|
||||
self.file_menu.entryconfigure(0, label=_('Status')) # LANG: Menu item
|
||||
self.file_menu.entryconfigure(1, label=_('Save Raw Data...')) # LANG: Menu item
|
||||
self.file_menu.entryconfigure(2, label=_('Settings')) # LANG: Item in the File menu on Windows
|
||||
self.file_menu.entryconfigure(4, label=_('Exit')) # LANG: Item in the File menu on Windows
|
||||
self.file_menu.entryconfigure(0, label=_('Status')) # LANG: File > Status
|
||||
self.file_menu.entryconfigure(1, label=_('Save Raw Data...')) # LANG: File > Save Raw Data...
|
||||
self.file_menu.entryconfigure(2, label=_('Settings')) # LANG: File > Settings (Windows)
|
||||
self.file_menu.entryconfigure(4, label=_('Exit')) # LANG: File > Exit
|
||||
|
||||
# Help menu
|
||||
self.help_menu.entryconfigure(0, label=_('Documentation')) # LANG: Help menu item
|
||||
self.help_menu.entryconfigure(1, label=_('Privacy Policy')) # LANG: Help menu item
|
||||
self.help_menu.entryconfigure(2, label=_('Release Notes')) # LANG: Help menu item
|
||||
self.help_menu.entryconfigure(3, label=_('Check for Updates...')) # LANG: Menu item
|
||||
self.help_menu.entryconfigure(4, label=_("About {APP}").format(APP=applongname)) # LANG: App menu entry
|
||||
self.help_menu.entryconfigure(0, label=_('Documentation')) # LANG: Help > Documentation
|
||||
self.help_menu.entryconfigure(1, label=_('Privacy Policy')) # LANG: Help > Privacy Policy
|
||||
self.help_menu.entryconfigure(2, label=_('Release Notes')) # LANG: Help > Release Notes
|
||||
self.help_menu.entryconfigure(3, label=_('Check for Updates...')) # LANG: Help > Check for Updates...
|
||||
self.help_menu.entryconfigure(4, label=_("About {APP}").format(APP=applongname)) # LANG: Help > About App
|
||||
|
||||
# Edit menu
|
||||
self.edit_menu.entryconfigure(0, label=_('Copy')) # LANG: As in Copy and Paste
|
||||
@@ -763,7 +764,7 @@ class AppWindow(object):
|
||||
self.w.update_idletasks()
|
||||
try:
|
||||
if companion.session.login(monitor.cmdr, monitor.is_beta):
|
||||
# Successfully authenticated with the Frontier website
|
||||
# LANG: Successfully authenticated with the Frontier website
|
||||
self.status['text'] = _('Authentication successful')
|
||||
|
||||
if platform == 'darwin':
|
||||
@@ -794,6 +795,7 @@ class AppWindow(object):
|
||||
if not self.status['text']:
|
||||
# Signal as error because the user might actually be docked
|
||||
# but the server hosting the Companion API hasn't caught up
|
||||
# LANG: Player is not docked at a station, when we expect them to be
|
||||
self.status['text'] = _("You're not docked at a station!")
|
||||
return False
|
||||
|
||||
@@ -861,17 +863,21 @@ class AppWindow(object):
|
||||
# Validation
|
||||
if 'commander' not in data:
|
||||
# This can happen with EGS Auth if no commander created yet
|
||||
# LANG: No data was returned for the commander from the Frontier CAPI
|
||||
err = self.status['text'] = _('CAPI: No commander data returned')
|
||||
|
||||
elif not data.get('commander', {}).get('name'):
|
||||
# LANG: We didn't have the commander name when we should have
|
||||
err = self.status['text'] = _("Who are you?!") # Shouldn't happen
|
||||
|
||||
elif (not data.get('lastSystem', {}).get('name')
|
||||
or (data['commander'].get('docked')
|
||||
and not data.get('lastStarport', {}).get('name'))):
|
||||
# LANG: We don't know where the commander is, when we should
|
||||
err = self.status['text'] = _("Where are you?!") # Shouldn't happen
|
||||
|
||||
elif not data.get('ship', {}).get('name') or not data.get('ship', {}).get('modules'):
|
||||
# LANG: We don't know what ship the commander is in, when we should
|
||||
err = self.status['text'] = _("What are you flying?!") # Shouldn't happen
|
||||
|
||||
elif monitor.cmdr and data['commander']['name'] != monitor.cmdr:
|
||||
@@ -979,6 +985,7 @@ class AppWindow(object):
|
||||
play_bad = True
|
||||
|
||||
if not err: # not self.status['text']: # no errors
|
||||
# LANG: Time when we last obtained Frontier CAPI data
|
||||
self.status['text'] = strftime(_('Last updated at %H:%M:%S'), localtime(querytime))
|
||||
|
||||
if play_sound and play_bad:
|
||||
@@ -1035,7 +1042,7 @@ class AppWindow(object):
|
||||
else:
|
||||
self.cmdr['text'] = monitor.cmdr
|
||||
|
||||
self.ship_label['text'] = _('Ship') + ':' # LANG: Main window
|
||||
self.ship_label['text'] = _('Ship') + ':' # LANG: 'Ship' label in main UI
|
||||
|
||||
# TODO: Show something else when on_foot
|
||||
if monitor.state['ShipName']:
|
||||
@@ -1058,7 +1065,7 @@ class AppWindow(object):
|
||||
|
||||
else:
|
||||
self.cmdr['text'] = ''
|
||||
self.ship_label['text'] = _('Ship') + ':' # LANG: Main window
|
||||
self.ship_label['text'] = _('Ship') + ':' # LANG: 'Ship' label in main UI
|
||||
self.ship['text'] = ''
|
||||
|
||||
if monitor.cmdr and monitor.is_beta:
|
||||
@@ -1437,6 +1444,7 @@ class AppWindow(object):
|
||||
config.set('geometry', f'+{x}+{y}')
|
||||
|
||||
# Let the user know we're shutting down.
|
||||
# LANG: The application is shutting down
|
||||
self.status['text'] = _('Shutting down...')
|
||||
self.w.update_idletasks()
|
||||
logger.info('Starting shutdown procedures...')
|
||||
@@ -1731,7 +1739,7 @@ sys.path: {sys.path}'''
|
||||
)
|
||||
|
||||
# Substitute in the other words.
|
||||
# LANG: words for use in python 2 plugin error
|
||||
# LANG: 'Plugins' tab / 'File' menu / 'File' > 'Settings'
|
||||
popup_text = popup_text.format(PLUGINS=_('Plugins'), FILE=_('File'), SETTINGS=_('Settings'),
|
||||
DISABLED='.disabled')
|
||||
# And now we do need these to be actual \r\n
|
||||
|
||||
+590
-599
File diff suppressed because it is too large.
Load diff
@@ -190,6 +190,7 @@ class _Translations:
|
||||
def available_names(self) -> Dict[Optional[str], str]:
|
||||
"""Available language names by code."""
|
||||
names: Dict[Optional[str], str] = OrderedDict([
|
||||
# LANG: The system default language choice in Settings > Appearance
|
||||
(None, _('Default')), # Appearance theme and language setting
|
||||
])
|
||||
names.update(sorted(
|
||||
|
||||
+3
-3
@@ -99,9 +99,9 @@ def prefs_changed(cmdr: str, is_beta: bool) -> None:
|
||||
beta_url = beta_textvar.get()
|
||||
override_mode = override_textvar.get()
|
||||
override_mode = { # Convert to unlocalised names
|
||||
_('Normal'): 'normal',
|
||||
_('Beta'): 'beta',
|
||||
_('Auto'): 'auto',
|
||||
_('Normal'): 'normal', # LANG: Coriolis normal/beta selection - normal
|
||||
_('Beta'): 'beta', # LANG: Coriolis normal/beta selection - beta
|
||||
_('Auto'): 'auto', # LANG: Coriolis normal/beta selection - auto
|
||||
}.get(override_mode, override_mode)
|
||||
|
||||
if override_mode not in ('beta', 'normal', 'auto'):
|
||||
|
||||
+1
-1
@@ -590,7 +590,7 @@ Msg:\n{msg}'''
|
||||
|
||||
else:
|
||||
# Can't access replay file! Send immediately.
|
||||
self.parent.children['status']['text'] = _('Sending data to EDDN...')
|
||||
self.parent.children['status']['text'] = _('Sending data to EDDN...') # LANG: Data is being sent to EDDN
|
||||
self.parent.update_idletasks()
|
||||
self.send(cmdr, msg)
|
||||
self.parent.children['status']['text'] = ''
|
||||
|
||||
+5
-1
@@ -213,6 +213,7 @@ def plugin_prefs(parent: tk.Tk, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
|
||||
this.label.grid(columnspan=2, padx=PADX, sticky=tk.W)
|
||||
|
||||
# LANG: Game Commander name label in EDSM settings
|
||||
this.cmdr_label = nb.Label(frame, text=_('Cmdr')) # Main window
|
||||
this.cmdr_label.grid(row=cur_row, padx=PADX, sticky=tk.W)
|
||||
this.cmdr_text = nb.Label(frame)
|
||||
@@ -220,6 +221,7 @@ def plugin_prefs(parent: tk.Tk, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
|
||||
cur_row += 1
|
||||
|
||||
# LANG: EDSM Commander name label in EDSM settings
|
||||
this.user_label = nb.Label(frame, text=_('Commander Name')) # EDSM setting
|
||||
this.user_label.grid(row=cur_row, padx=PADX, sticky=tk.W)
|
||||
this.user = nb.Entry(frame)
|
||||
@@ -227,6 +229,7 @@ def plugin_prefs(parent: tk.Tk, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
|
||||
cur_row += 1
|
||||
|
||||
# LANG: EDSM API key label
|
||||
this.apikey_label = nb.Label(frame, text=_('API Key')) # EDSM setting
|
||||
this.apikey_label.grid(row=cur_row, padx=PADX, sticky=tk.W)
|
||||
this.apikey = nb.Entry(frame)
|
||||
@@ -253,7 +256,8 @@ def prefs_cmdr_changed(cmdr: str, is_beta: bool) -> None:
|
||||
this.apikey.insert(0, cred[1])
|
||||
|
||||
else:
|
||||
this.cmdr_text['text'] = _('None') # No hotkey/shortcut currently defined
|
||||
# LANG: We have no data on the current commander
|
||||
this.cmdr_text['text'] = _('None')
|
||||
|
||||
to_set = tk.DISABLED
|
||||
if cmdr and not is_beta and this.log.get():
|
||||
|
||||
@@ -230,6 +230,7 @@ def plugin_prefs(parent: tk.Tk, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
|
||||
this.label.grid(columnspan=2, padx=x_padding, sticky=tk.W)
|
||||
|
||||
# LANG: Inara API key label
|
||||
this.apikey_label = nb.Label(frame, text=_('API Key')) # Inara setting
|
||||
this.apikey_label.grid(row=12, padx=x_padding, sticky=tk.W)
|
||||
this.apikey = nb.Entry(frame)
|
||||
|
||||
@@ -294,6 +294,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
buttonframe.grid(padx=self.PADX, pady=self.PADX, sticky=tk.NSEW)
|
||||
buttonframe.columnconfigure(0, weight=1)
|
||||
ttk.Label(buttonframe).grid(row=0, column=0) # spacer
|
||||
# LANG: 'OK' button on Settings/Preferences window
|
||||
button = ttk.Button(buttonframe, text=_('OK'), command=self.apply)
|
||||
button.grid(row=0, column=1, sticky=tk.E)
|
||||
button.bind("<Return>", lambda event: self.apply())
|
||||
@@ -378,6 +379,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
|
||||
self.outdir = tk.StringVar()
|
||||
self.outdir.set(str(config.get_str('outdir')))
|
||||
# LANG: Label for "where files are located"
|
||||
self.outdir_label = nb.Label(output_frame, text=_('File location')+':') # Section heading in settings
|
||||
# Type ignored due to incorrect type annotation. a 2 tuple does padding for each side
|
||||
self.outdir_label.grid(padx=self.PADX, pady=(5, 0), sticky=tk.W, row=row.get()) # type: ignore
|
||||
@@ -394,7 +396,8 @@ class PreferencesDialog(tk.Toplevel):
|
||||
|
||||
nb.Frame(output_frame).grid(row=row.get()) # bottom spacer # TODO: does nothing?
|
||||
|
||||
root_notebook.add(output_frame, text=_('Output')) # Tab heading in settings
|
||||
# LANG: Label for 'Output' Settings tab
|
||||
root_notebook.add(output_frame, text=_('Output')) # Tab heading in settings
|
||||
|
||||
def __setup_plugin_tabs(self, notebook: Notebook) -> None:
|
||||
for plugin in plug.PLUGINS:
|
||||
@@ -451,9 +454,9 @@ class PreferencesDialog(tk.Toplevel):
|
||||
self.hotkey_play = tk.IntVar(value=not config.get_int('hotkey_mute'))
|
||||
nb.Label(
|
||||
config_frame,
|
||||
text=_('Keyboard shortcut') if # Hotkey/Shortcut settings prompt on OSX
|
||||
text=_('Keyboard shortcut') if # LANG: Hotkey/Shortcut settings prompt on OSX
|
||||
platform == 'darwin' else
|
||||
_('Hotkey') # Hotkey/Shortcut settings prompt on Windows
|
||||
_('Hotkey') # LANG: Hotkey/Shortcut settings prompt on Windows
|
||||
).grid(padx=self.PADX, sticky=tk.W, row=row.get())
|
||||
|
||||
if platform == 'darwin' and not was_accessible_at_launch:
|
||||
@@ -473,7 +476,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
foreground='firebrick'
|
||||
).grid(columnspan=4, padx=self.PADX, sticky=tk.W, row=row.get())
|
||||
|
||||
# Shortcut settings button on OSX
|
||||
# LANG: Shortcut settings button on OSX
|
||||
nb.Button(config_frame, text=_('Open System Preferences'), command=self.enableshortcuts).grid(
|
||||
padx=self.PADX, sticky=tk.E, row=row.get()
|
||||
)
|
||||
@@ -484,6 +487,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
0,
|
||||
# No hotkey/shortcut currently defined
|
||||
# TODO: display Only shows up on darwin or windows
|
||||
# LANG: No hotkey/shortcut set
|
||||
hotkeymgr.display(self.hotkey_code, self.hotkey_mods) if self.hotkey_code else _('None')
|
||||
)
|
||||
|
||||
@@ -530,6 +534,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
)
|
||||
|
||||
# Settings prompt for preferred ship loadout, system and station info websites
|
||||
# LANG: Label for preferred shipyard, system and station 'providers'
|
||||
nb.Label(config_frame, text=_('Preferred websites')).grid(
|
||||
columnspan=4, padx=self.PADX, sticky=tk.W, row=row.get()
|
||||
)
|
||||
@@ -540,6 +545,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
value=str(shipyard_provider if shipyard_provider in plug.provides('shipyard_url') else 'EDSY')
|
||||
)
|
||||
# Setting to decide which ship outfitting website to link to - either E:D Shipyard or Coriolis
|
||||
# LANG: Label for Shipyard provider selection
|
||||
nb.Label(config_frame, text=_('Shipyard')).grid(padx=self.PADX, pady=2*self.PADY, sticky=tk.W, row=cur_row)
|
||||
self.shipyard_button = nb.OptionMenu(
|
||||
config_frame, self.shipyard_provider, self.shipyard_provider.get(), *plug.provides('shipyard_url')
|
||||
@@ -551,6 +557,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
self.alt_shipyard_open = tk.IntVar(value=config.get_int('use_alt_shipyard_open'))
|
||||
self.alt_shipyard_open_btn = nb.Checkbutton(
|
||||
config_frame,
|
||||
# LANG: Label for checkbox to utilise alternative Coriolis URL method
|
||||
text=_('Use alternate URL method'),
|
||||
variable=self.alt_shipyard_open,
|
||||
command=self.alt_shipyard_open_changed,
|
||||
@@ -628,18 +635,22 @@ class PreferencesDialog(tk.Toplevel):
|
||||
# Big spacer
|
||||
nb.Label(config_frame).grid(sticky=tk.W, row=row.get())
|
||||
|
||||
notebook.add(config_frame, text=_('Configuration')) # Tab heading in settings
|
||||
# LANG: Label for 'Configuration' tab in Settings
|
||||
notebook.add(config_frame, text=_('Configuration'))
|
||||
|
||||
def __setup_appearance_tab(self, notebook: Notebook) -> None:
|
||||
self.languages = Translations.available_names()
|
||||
# Appearance theme and language setting
|
||||
# LANG: The system default language choice in Settings > Appearance
|
||||
self.lang = tk.StringVar(value=self.languages.get(config.get_str('language'), _('Default')))
|
||||
self.always_ontop = tk.BooleanVar(value=bool(config.get_int('always_ontop')))
|
||||
# self.minimize_system_tray = tk.BooleanVar(value=config.get_bool('minimize_system_tray'))
|
||||
self.theme = tk.IntVar(value=config.get_int('theme'))
|
||||
self.theme_colors = [config.get_str('dark_text'), config.get_str('dark_highlight')]
|
||||
self.theme_prompts = [
|
||||
# LANG: Label for Settings > Appeareance > selection of 'normal' text colour
|
||||
_('Normal text'), # Dark theme color setting
|
||||
# LANG: Label for Settings > Appeareance > selection of 'highlightes' text colour
|
||||
_('Highlighted text'), # Dark theme color setting
|
||||
]
|
||||
|
||||
@@ -657,21 +668,25 @@ class PreferencesDialog(tk.Toplevel):
|
||||
)
|
||||
|
||||
# Appearance setting
|
||||
# LANG: Label for Settings > Appearance > Theme selection
|
||||
nb.Label(appearance_frame, text=_('Theme')).grid(columnspan=3, padx=self.PADX, sticky=tk.W, row=row.get())
|
||||
|
||||
# Appearance theme and language setting
|
||||
nb.Radiobutton(
|
||||
# LANG: Label for 'Default' theme radio button
|
||||
appearance_frame, text=_('Default'), variable=self.theme, value=0, command=self.themevarchanged
|
||||
).grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get())
|
||||
|
||||
# Appearance theme setting
|
||||
nb.Radiobutton(
|
||||
# LANG: Label for 'Dark' theme radio button
|
||||
appearance_frame, text=_('Dark'), variable=self.theme, value=1, command=self.themevarchanged
|
||||
).grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get())
|
||||
|
||||
if platform == 'win32':
|
||||
nb.Radiobutton(
|
||||
appearance_frame,
|
||||
# LANG: Label for 'Transparent' theme radio button
|
||||
text=_('Transparent'), # Appearance theme setting
|
||||
variable=self.theme,
|
||||
value=2,
|
||||
@@ -801,6 +816,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
|
||||
nb.Label(appearance_frame).grid(sticky=tk.W) # big spacer
|
||||
|
||||
# LANG: Label for Settings > Appearance tab
|
||||
notebook.add(appearance_frame, text=_('Appearance')) # Tab heading in settings
|
||||
|
||||
def __setup_plugin_tab(self, notebook: Notebook) -> None:
|
||||
@@ -811,15 +827,18 @@ class PreferencesDialog(tk.Toplevel):
|
||||
plugdir.set(config.plugin_dir)
|
||||
row = AutoInc(1)
|
||||
|
||||
# Section heading in settings
|
||||
nb.Label(plugins_frame, text=_('Plugins folder')+':').grid(padx=self.PADX, sticky=tk.W)
|
||||
plugdirentry = nb.Entry(plugins_frame, justify=tk.LEFT)
|
||||
self.displaypath(plugdir, plugdirentry)
|
||||
with row as cur_row:
|
||||
# Section heading in settings
|
||||
# LANG: Label for location of third-party plugins folder
|
||||
nb.Label(plugins_frame, text=_('Plugins folder') + ':').grid(padx=self.PADX, sticky=tk.W, row=cur_row)
|
||||
|
||||
plugdirentry.grid(padx=self.PADX, sticky=tk.EW, row=cur_row)
|
||||
|
||||
nb.Button(
|
||||
plugins_frame,
|
||||
# LANG: Label on button used to open a filesystem folder
|
||||
text=_('Open'), # Button that opens a folder in Explorer/Finder
|
||||
command=lambda: webbrowser.open(f'file:///{config.plugin_dir_path}')
|
||||
).grid(column=1, padx=(0, self.PADX), sticky=tk.NSEW, row=cur_row)
|
||||
@@ -827,6 +846,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
nb.Label(
|
||||
plugins_frame,
|
||||
# Help text in settings
|
||||
# LANG: Tip/label about how to disable plugins
|
||||
text=_("Tip: You can disable a plugin by{CR}adding '{EXT}' to its folder name").format(EXT='.disabled')
|
||||
).grid(columnspan=2, padx=self.PADX, pady=10, sticky=tk.NSEW, row=row.get())
|
||||
|
||||
@@ -837,6 +857,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
)
|
||||
nb.Label(
|
||||
plugins_frame,
|
||||
# LANG: Label on list of enabled plugins
|
||||
text=_('Enabled Plugins')+':' # List of plugins in settings
|
||||
).grid(padx=self.PADX, sticky=tk.W, row=row.get())
|
||||
|
||||
@@ -877,6 +898,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
)
|
||||
nb.Label(
|
||||
plugins_frame,
|
||||
# LANG: Lable on list of user-disabled plugins
|
||||
text=_('Disabled Plugins')+':' # List of plugins in settings
|
||||
).grid(padx=self.PADX, sticky=tk.W, row=row.get())
|
||||
|
||||
@@ -885,6 +907,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
columnspan=2, padx=self.PADX*2, sticky=tk.W, row=row.get()
|
||||
)
|
||||
|
||||
# LANG: Label on Settings > Plugins tab
|
||||
notebook.add(plugins_frame, text=_('Plugins')) # Tab heading in settings
|
||||
|
||||
def cmdrchanged(self, event=None):
|
||||
@@ -1087,7 +1110,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
event.widget.delete(0, tk.END)
|
||||
self.hotkey_text.insert(
|
||||
0,
|
||||
# No hotkey/shortcut currently defined
|
||||
# LANG: No hotkey/shortcut set
|
||||
hotkeymgr.display(self.hotkey_code, self.hotkey_mods) if self.hotkey_code else _('None'))
|
||||
|
||||
def hotkeylisten(self, event: 'tk.Event[Any]') -> str:
|
||||
@@ -1120,7 +1143,8 @@ class PreferencesDialog(tk.Toplevel):
|
||||
self.hotkey_play_btn['state'] = tk.NORMAL
|
||||
|
||||
else:
|
||||
event.widget.insert(0, _('None')) # No hotkey/shortcut currently defined
|
||||
# LANG: No hotkey/shortcut set
|
||||
event.widget.insert(0, _('None'))
|
||||
self.hotkey_only_btn['state'] = tk.DISABLED
|
||||
self.hotkey_play_btn['state'] = tk.DISABLED
|
||||
|
||||
|
||||
@@ -64,38 +64,39 @@ def extract_comments(call: ast.Call, lines: list[str], file: pathlib.Path) -> Op
|
||||
:param file: The path to the file this call node came from
|
||||
:return: The first comment that matches the rules, or None
|
||||
"""
|
||||
out: list[Optional[str]] = []
|
||||
out: Optional[str] = None
|
||||
above = call.lineno - 2
|
||||
current = call.lineno - 1
|
||||
|
||||
above_line = lines[above].strip() if len(lines) < above else None
|
||||
above_line = lines[above].strip() if len(lines) >= above else None
|
||||
current_line = lines[current].strip()
|
||||
|
||||
bad_comment: Optional[str] = None
|
||||
for line in (above_line, current_line):
|
||||
if line is None or '#' not in line:
|
||||
out.append(None)
|
||||
continue
|
||||
|
||||
match = COMMENT_RE.match(line)
|
||||
if not match:
|
||||
print(line)
|
||||
out.append(None)
|
||||
continue
|
||||
|
||||
comment = match.group(1).strip()
|
||||
if not comment.startswith('# LANG:'):
|
||||
print(f'Unknown comment for {file}:{current} {line}', file=sys.stderr)
|
||||
out.append(None)
|
||||
bad_comment = f'Unknown comment for {file}:{current} {line}'
|
||||
continue
|
||||
|
||||
out.append(comment.replace('# LANG:', '').strip())
|
||||
out = comment.replace('# LANG:', '').strip()
|
||||
bad_comment = None
|
||||
break
|
||||
|
||||
if out[1] is not None:
|
||||
return out[1]
|
||||
elif out[0] is not None:
|
||||
return out[0]
|
||||
if bad_comment is not None:
|
||||
print(bad_comment, file=sys.stderr)
|
||||
|
||||
return None
|
||||
if out is None:
|
||||
print(f'No comment for {file}:{current} {line}', file=sys.stderr)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
def scan_file(path: pathlib.Path) -> list[ast.Call]:
|
||||
@@ -239,7 +240,10 @@ def generate_lang_template(data: dict[pathlib.Path, list[ast.Call]]) -> str:
|
||||
entries.append(LangEntry([FileLocation.from_call(path, c)], get_arg(c), [getattr(c, 'comment')]))
|
||||
|
||||
deduped = dedupe_lang_entries(entries)
|
||||
out = ''
|
||||
out = '''/* Language name */
|
||||
"!Language" = "English";
|
||||
|
||||
'''
|
||||
print(f'Done Deduping entries {len(entries)=} {len(deduped)=}', file=sys.stderr)
|
||||
for entry in deduped:
|
||||
assert len(entry.comments) == len(entry.locations)
|
||||
@@ -270,8 +274,8 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--ignore', action='append', help='directories to ignore', default=['venv', '.git'])
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument('--json', action='store_true', help='JSON output')
|
||||
group.add_argument('--lang', action='store_true', help='lang file outpot')
|
||||
group.add_argument('--compare-lang')
|
||||
group.add_argument('--lang', help='en.template "strings" output to specified file, "-" for stdout')
|
||||
group.add_argument('--compare-lang', help='en.template file to compare against')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -310,7 +314,12 @@ if __name__ == '__main__':
|
||||
print(json.dumps(to_print_data, indent=2))
|
||||
|
||||
elif args.lang:
|
||||
print(generate_lang_template(res))
|
||||
if args.lang == '-':
|
||||
print(generate_lang_template(res))
|
||||
|
||||
else:
|
||||
with open(args.lang, mode='w+', newline='\n') as langfile:
|
||||
langfile.writelines(generate_lang_template(res))
|
||||
|
||||
else:
|
||||
for path, calls in res.items():
|
||||
|
||||
@@ -223,6 +223,7 @@ class _Theme(object):
|
||||
'disabledforeground' : '#%02x%02x%02x' % (int(r/384), int(g/384), int(b/384)),
|
||||
'highlight' : config.get_str('dark_highlight'),
|
||||
# Font only supports Latin 1 / Supplement / Extended, and a few General Punctuation and Mathematical Operators
|
||||
# LANG: Label for commander name in main window
|
||||
'font' : (theme > 1 and not 0x250 < ord(_('Cmdr')[0]) < 0x3000 and
|
||||
tkFont.Font(family='Euro Caps', size=10, weight=tkFont.NORMAL) or
|
||||
'TkDefaultFont'),
|
||||
|
||||
@@ -38,7 +38,8 @@ class HyperlinkLabel(platform == 'darwin' and tk.Label or ttk.Label, object):
|
||||
self.bind('<Button-1>', self._click)
|
||||
|
||||
self.menu = tk.Menu(None, tearoff=tk.FALSE)
|
||||
self.menu.add_command(label=_('Copy'), command = self.copy) # As in Copy and Paste
|
||||
# LANG: Label for 'Copy' as in 'Copy and Paste'
|
||||
self.menu.add_command(label=_('Copy'), command = self.copy) # As in Copy and Paste
|
||||
self.bind(platform == 'darwin' and '<Button-2>' or '<Button-3>', self._contextmenu)
|
||||
|
||||
self.bind('<Enter>', self._enter)
|
||||
|
||||
Reference in new issue
Block a user