1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 15:57:14 +03:00

Fixed localisation

This commit is contained in:
A_D 2021-05-28 10:23:56 +02:00
parent ebb5ac49bc
commit 37b37eae56
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4
2 changed files with 43 additions and 4 deletions

View File

@ -601,3 +601,30 @@
/* Shortcut settings prompt on OSX. [prefs.py] */
"{APP} needs permission to use shortcuts" = "{APP} needs permission to use shortcuts";
/* Coriolis override modes [plugins/coriolis.py] */
"Normal" = "Normal";
/* Coriolis override modes [plugins/coriolis.py] */
"Beta" = "Beta";
/* Coriolis override modes [plugins/coriolis.py] */
"Auto" = "Auto";
/* Coriolis override label [plugins/coriolis.py] */
"Override Beta/Normal Selection" = "Override Beta/Normal Selection";
/* Coriolis reset buttons [plugins/coriolis.py] */
"Reset" = "Reset";
/* Coriolis Normal URL label [plugins/coriolis.py] */
"Normal URL" = "Normal URL";
/* Coriolis Beta URL label [plugins/coriolis.py] */
"Beta URL" = "Beta URL";
/* Coriolis config title label [plugins/coriolis.py] */
"Set the URL to use with coriolis.io ship loadouts. Note that this MUST end with 'import?data='" = "Set the URL to use with coriolis.io ship loadouts. Note that this MUST end with 'import?data='";
/* Coriolis invalid mode warning [plugins/coriolis.py] */
"Invalid Coriolis override mode!" = "Invalid Coriolis override mode!";

View File

@ -6,9 +6,10 @@ import io
import json
import tkinter as tk
from typing import TYPE_CHECKING, Union
from EDMCLogging import get_main_logger
import myNotebook as nb # noqa: N813 # its not my fault.
from EDMCLogging import get_main_logger
from plug import show_error
if TYPE_CHECKING:
def _(s: str) -> str:
@ -59,7 +60,7 @@ def plugin_prefs(parent: tk.Widget, cmdr: str, is_beta: bool) -> tk.Frame:
conf_frame.columnconfigure(index=1, weight=1)
cur_row = 0
nb.Label(conf_frame, text=_(
'Set the URL to use with coriolis.io ship loadouts. Note that this MUST end with "/import?data="\n'
"Set the URL to use with coriolis.io ship loadouts. Note that this MUST end with '/import?data='"
)).grid(sticky=tk.EW, row=cur_row, column=0, columnspan=3)
cur_row += 1
@ -77,12 +78,12 @@ def plugin_prefs(parent: tk.Widget, cmdr: str, is_beta: bool) -> tk.Frame:
)
cur_row += 1
nb.Label(conf_frame, text=_('Override beta/normal selection')).grid(sticky=tk.W, row=cur_row, column=0, padx=PADX)
nb.Label(conf_frame, text=_('Override Beta/Normal selection')).grid(sticky=tk.W, row=cur_row, column=0, padx=PADX)
nb.OptionMenu(
conf_frame,
override_textvar,
override_textvar.get(),
'normal', 'beta', 'auto'
_('Normal'), _('Beta'), _('Auto')
).grid(sticky=tk.W, row=cur_row, column=1, padx=PADX)
cur_row += 1
@ -95,6 +96,11 @@ def prefs_changed(cmdr: str, is_beta: bool) -> None:
normal_url = normal_textvar.get()
beta_url = beta_textvar.get()
override_mode = override_textvar.get()
override_mode = { # Convert to unlocalised names
_('Normal'): 'normal',
_('Beta'): 'beta',
_('Auto'): 'auto',
}.get(override_mode, override_mode)
if override_mode not in ('beta', 'normal', 'auto'):
logger.warning(f'Unexpected value {override_mode=!r}. defaulting to "auto"')
@ -107,6 +113,12 @@ def prefs_changed(cmdr: str, is_beta: bool) -> None:
def _get_target_url(is_beta: bool) -> str:
global override_mode
if override_mode not in ('auto', 'normal', 'beta'):
show_error(_('Invalid Coriolis override mode!'))
logger.warning(f'Unexpected override mode {override_mode!r}! defaulting to auto!')
override_mode = 'auto'
if override_mode == 'beta':
return beta_url
elif override_mode == 'normal':