Start working through the files, adding translation strings

This commit is contained in:
blitzmann
2020-05-16 14:42:29 -04:00
parent fdd06ed3d6
commit 5177768962
5 changed files with 121 additions and 121 deletions

View File

@@ -69,6 +69,7 @@ from service.price import Price
from service.settings import HTMLExportSettings, SettingsProvider
from service.update import Update
_ = wx.GetTranslation
pyfalog = Logger(__name__)
@@ -182,7 +183,7 @@ class MainFrame(wx.Frame):
self.marketBrowser.splitter.SetSashPosition(self.marketHeight)
self.shipBrowser = ShipBrowser(self.notebookBrowsers)
self.notebookBrowsers.AddPage(self.shipBrowser, "Fittings", image=shipBrowserImg, closeable=False)
self.notebookBrowsers.AddPage(self.shipBrowser, _("Fittings"), image=shipBrowserImg, closeable=False)
self.notebookBrowsers.SetSelection(1)
@@ -269,7 +270,7 @@ class MainFrame(wx.Frame):
self.fitMultiSwitch.AddPage()
return
self.waitDialog = wx.BusyInfo("Loading previous fits...", parent=self)
self.waitDialog = wx.BusyInfo(_("Loading previous fits..."), parent=self)
OpenFitsThread(fits, self.closeWaitDialog)
def _getDisplayData(self):
@@ -412,7 +413,7 @@ class MainFrame(wx.Frame):
# except:
# matplotlib_version = None
#
# info.Description = wordwrap(gui.aboutData.description + "\n\nDevelopers:\n\t" +
# info.Description = wordwrap(gui.aboutData.description + _("\n\nDevelopers:\n\t") +
# "\n\t".join(gui.aboutData.developers) +
# "\n\nAdditional credits:\n\t" +
# "\n\t".join(gui.aboutData.credits) +
@@ -462,8 +463,8 @@ class MainFrame(wx.Frame):
defaultFile = "%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None
with wx.FileDialog(
self, "Save Fitting As...",
wildcard="EVE XML fitting files (*.xml)|*.xml",
self, _("Save Fitting As..."),
wildcard=_("EVE XML fitting files (*.xml)|*.xml"),
style=wx.FD_SAVE,
defaultFile=defaultFile
) as dlg:
@@ -640,15 +641,15 @@ class MainFrame(wx.Frame):
if not fit.ignoreRestrictions:
with wx.MessageDialog(
self, "Are you sure you wish to ignore fitting restrictions for the "
"current fit? This could lead to wildly inaccurate results and possible errors.",
"Confirm", wx.YES_NO | wx.ICON_QUESTION
self, _("Are you sure you wish to ignore fitting restrictions for the "
"current fit? This could lead to wildly inaccurate results and possible errors."),
_("Confirm"), wx.YES_NO | wx.ICON_QUESTION
) as dlg:
result = dlg.ShowModal() == wx.ID_YES
else:
with wx.MessageDialog(
self, "Re-enabling fitting restrictions for this fit will also remove any illegal items "
"from the fit. Do you want to continue?", "Confirm", wx.YES_NO | wx.ICON_QUESTION
self, _("Re-enabling fitting restrictions for this fit will also remove any illegal items "
"from the fit. Do you want to continue?"), _("Confirm"), wx.YES_NO | wx.ICON_QUESTION
) as dlg:
result = dlg.ShowModal() == wx.ID_YES
if result:
@@ -666,7 +667,7 @@ class MainFrame(wx.Frame):
menu = self.GetMenuBar()
sEsi = Esi.getInstance()
menu.SetLabel(menu.ssoLoginId, "Manage Characters")
menu.SetLabel(menu.ssoLoginId, _("Manage Characters"))
enable = len(sEsi.getSsoCharacters()) == 0
menu.Enable(menu.eveFittingsId, not enable)
menu.Enable(menu.exportToEveId, not enable)
@@ -683,7 +684,7 @@ class MainFrame(wx.Frame):
wx.PostEvent(self, GE.FitChanged(fitIDs=changedFitIDs))
menu = self.GetMenuBar()
menu.SetLabel(menu.toggleOverridesId,
"&Turn Overrides Off" if ModifiedAttributeDict.overrides_enabled else "&Turn Overrides On")
_("&Turn Overrides Off") if ModifiedAttributeDict.overrides_enabled else _("&Turn Overrides On"))
def saveChar(self, event):
sChr = Character.getInstance()
@@ -716,7 +717,7 @@ class MainFrame(wx.Frame):
fitItems = {i for i in Fit.fitItemIter(fit, forceFitImplants=True) if i is not fit.ship.item}
self.disablerAll = wx.WindowDisabler()
self.waitDialog = wx.BusyInfo("Please Wait...", parent=self)
self.waitDialog = wx.BusyInfo(_("Please Wait..."), parent=self)
Price.getInstance().findCheaperReplacements(fitItems, updateFitCb, fetchTimeout=10)
def AdditionsTabSelect(self, event):
@@ -800,10 +801,12 @@ class MainFrame(wx.Frame):
sCharacter = Character.getInstance()
with wx.FileDialog(
self,
"Export Skills Needed As...",
wildcard=("EVEMon skills training file (*.emp)|*.emp|"
"EVEMon skills training XML file (*.xml)|*.xml|"
"Text skills training file (*.txt)|*.txt"),
_("Export Skills Needed As..."),
wildcard=("|".join([
_("EVEMon skills training file") + " (*.emp)|*.emp",
_("EVEMon skills training XML file") +" (*.xml)|*.xml",
_("Text skills training file") + " (*.txt)|*.txt"
])),
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
) as dlg:
if dlg.ShowModal() == wx.ID_OK:
@@ -820,22 +823,24 @@ class MainFrame(wx.Frame):
if '.' not in os.path.basename(filePath):
filePath += ".{0}".format(saveFmt)
self.waitDialog = wx.BusyInfo("Exporting skills needed...", parent=self)
self.waitDialog = wx.BusyInfo(_("Exporting skills needed..."), parent=self)
sCharacter.backupSkills(filePath, saveFmt, self.getActiveFit(), self.closeWaitDialog)
def fileImportDialog(self, event):
"""Handles importing single/multiple EVE XML / EFT cfg fit files"""
with wx.FileDialog(
self,
"Open One Or More Fitting Files",
wildcard=("EVE XML fitting files (*.xml)|*.xml|"
"EFT text fitting files (*.cfg)|*.cfg|"
"All Files (*)|*"),
_("Open One Or More Fitting Files"),
wildcard=("|".join([
_("EVE XML fitting files") + " (*.xml)|*.xml",
_("EFT text fitting files") + " (*.cfg)|*.cfg",
_("All Files") + "|*"
])),
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE
) as dlg:
if dlg.ShowModal() == wx.ID_OK:
self.progressDialog = wx.ProgressDialog(
"Importing fits",
_("Importing fits"),
" " * 100, # set some arbitrary spacing to create width in window
parent=self,
style=wx.PD_CAN_ABORT | wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_APP_MODAL
@@ -849,8 +854,8 @@ class MainFrame(wx.Frame):
with wx.FileDialog(
self,
"Save Backup As...",
wildcard="EVE XML fitting file (*.xml)|*.xml",
_("Save Backup As..."),
wildcard=_("EVE XML fitting file")+" (*.xml)|*.xml",
style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
defaultFile=defaultFile,
) as dlg:
@@ -863,8 +868,8 @@ class MainFrame(wx.Frame):
max_ = sFit.countAllFits()
self.progressDialog = wx.ProgressDialog(
"Backup fits",
"Backing up %d fits to: %s" % (max_, filePath),
_("Backup fits"),
_("Backing up {} fits to: {}").format(max_, filePath),
maximum=max_,
parent=self,
style=wx.PD_CAN_ABORT | wx.PD_SMOOTH | wx.PD_ELAPSED_TIME | wx.PD_APP_MODAL
@@ -883,16 +888,19 @@ class MainFrame(wx.Frame):
if not os.path.isdir(os.path.dirname(path)):
with wx.MessageDialog(
self,
"Invalid Path\n\nThe following path is invalid or does not exist: \n%s\n\nPlease verify path location pyfa's preferences." % path,
"Error",
_("Invalid Path") + "\n\n" +
_("The following path is invalid or does not exist:") +
f"\n{path}\n\n" +
_("Please verify path location pyfa's preferences."),
_("Error"),
wx.OK | wx.ICON_ERROR
) as dlg:
if dlg.ShowModal() == wx.ID_OK:
return
self.progressDialog = wx.ProgressDialog(
"Backup fits",
"Generating HTML file at: %s" % path,
_("Backup fits"),
_("Generating HTML file at: {}").format(path),
maximum=max_, parent=self,
style=wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME)
@@ -934,10 +942,12 @@ class MainFrame(wx.Frame):
_message = None
if action & IPortUser.ID_ERROR:
self.closeProgressDialog()
_message = "Import Error" if action & IPortUser.PROCESS_IMPORT else "Export Error"
_message = _("Import Error") if action & IPortUser.PROCESS_IMPORT else _("Export Error")
with wx.MessageDialog(
self,
"The following error was generated\n\n%s\n\nBe aware that already processed fits were not saved" % data,
_("The following error was generated") +
f"\n\n{data}\n\n" +
_("Be aware that already processed fits were not saved"),
_message, wx.OK | wx.ICON_ERROR
) as dlg:
dlg.ShowModal()
@@ -996,13 +1006,16 @@ class MainFrame(wx.Frame):
""" Imports character XML file from EVE API """
with wx.FileDialog(
self,
"Open One Or More Character Files",
wildcard="EVE API XML character files (*.xml)|*.xml|All Files (*)|*",
_("Open One Or More Character Files"),
wildcard="|".join([
_("EVE API XML character files") + " (*.xml)|*.xml",
_("All Files") + "|*"
]),
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST | wx.FD_MULTIPLE
) as dlg:
if dlg.ShowModal() == wx.ID_OK:
self.supress_left_up = True
self.waitDialog = wx.BusyInfo("Importing Character...", parent=self)
self.waitDialog = wx.BusyInfo(_("Importing Character..."), parent=self)
sCharacter = Character.getInstance()
sCharacter.importCharacter(dlg.GetPaths(), self.importCharacterCallback)