i18n: more annotation

This commit is contained in:
zhaoweny
2020-07-01 11:48:06 +08:00
parent 29f6ac0d99
commit 85e779469f
3 changed files with 16 additions and 16 deletions

View File

@@ -10,17 +10,16 @@ from service.fit import Fit
_t = wx.GetTranslation
optionMap = OrderedDict((
('High Security', FitSystemSecurity.HISEC),
('Low Security', FitSystemSecurity.LOWSEC),
('Null Security', FitSystemSecurity.NULLSEC),
('W-Space', FitSystemSecurity.WSPACE)))
class FitSystemSecurityMenu(ContextMenuUnconditional):
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
self.optionMap = OrderedDict((
(_t('High Security'), FitSystemSecurity.HISEC),
(_t('Low Security'), FitSystemSecurity.LOWSEC),
(_t('Null Security'), FitSystemSecurity.NULLSEC),
(_t('W-Space'), FitSystemSecurity.WSPACE)))
def display(self, callingWindow, srcContext):
if srcContext != "fittingShip":
@@ -50,7 +49,7 @@ class FitSystemSecurityMenu(ContextMenuUnconditional):
msw = True if "wxMSW" in wx.PlatformInfo else False
self.optionIds = {}
sub = wx.Menu()
for optionLabel, optionValue in optionMap.items():
for optionLabel, optionValue in self.optionMap.items():
menuItem = self.addOption(rootMenu if msw else sub, optionLabel)
sub.Append(menuItem)
menuItem.Check(fit.getSystemSecurity() == optionValue)
@@ -59,7 +58,7 @@ class FitSystemSecurityMenu(ContextMenuUnconditional):
def handleMode(self, event):
optionLabel = self.optionIds[event.Id]
optionValue = optionMap[optionLabel]
optionValue = self.optionMap[optionLabel]
self.mainFrame.command.Submit(cmd.GuiChangeFitSystemSecurityCommand(
fitID=self.mainFrame.getActiveFit(),
secStatus=optionValue))

View File

@@ -30,7 +30,7 @@ class TargetProfileSwitcher(ContextMenuUnconditional):
def getText(self, callingWindow, itmContext):
# We take into consideration just target resists, so call menu item accordingly
return 'Target Resists'
return _t('Target Resists')
def handleResistSwitch(self, event):
profile = self.profileEventMap.get(event.Id, False)
@@ -80,7 +80,7 @@ class TargetProfileSwitcher(ContextMenuUnconditional):
def makeMenu(container, parentMenu, first=False):
menu = wx.Menu()
if first:
mitem, checked = self._addProfile(rootMenu if msw else parentMenu, None, 'No Profile')
mitem, checked = self._addProfile(rootMenu if msw else parentMenu, None, _t('No Profile'))
menu.Append(mitem)
mitem.Check(checked)
if len(container[0]) > 0 or len(container[1]) > 0:

View File

@@ -20,6 +20,7 @@ from service.fit import Fit
from .events import BoosterListUpdated, FitSelected, ImportSelected, SearchSelected, Stage3Selected
pyfalog = Logger(__name__)
_t = wx.GetTranslation
class FitItem(SFItem.SFBrowserItem):
@@ -103,9 +104,9 @@ class FitItem(SFItem.SFBrowserItem):
self.SetDraggable()
self.boosterBtn = self.toolbar.AddButton(self.boosterBmp, "Booster", show=self.fitBooster)
self.toolbar.AddButton(self.copyBmp, "Copy", self.copyBtnCB)
self.renameBtn = self.toolbar.AddButton(self.renameBmp, "Rename", self.renameBtnCB)
self.toolbar.AddButton(self.deleteBmp, "Delete", self.deleteBtnCB)
self.toolbar.AddButton(self.copyBmp, _t("Copy"), self.copyBtnCB)
self.renameBtn = self.toolbar.AddButton(self.renameBmp, _t("Rename"), self.renameBtnCB)
self.toolbar.AddButton(self.deleteBmp, _t("Delete"), self.deleteBtnCB)
self.tcFitName = wx.TextCtrl(self, wx.ID_ANY, "%s" % self.fitName, wx.DefaultPosition, (self.editWidth, -1),
wx.TE_PROCESS_ENTER)
@@ -223,13 +224,13 @@ class FitItem(SFItem.SFBrowserItem):
# menu.AppendSubMenu(boosterMenu, 'Set Booster')
if fit:
newTabItem = menu.Append(wx.ID_ANY, "Open in new tab")
newTabItem = menu.Append(wx.ID_ANY, _t("Open in new tab"))
self.Bind(wx.EVT_MENU, self.OpenNewTab, newTabItem)
projectedItem = menu.Append(wx.ID_ANY, "Project onto Active Fit")
projectedItem = menu.Append(wx.ID_ANY, _t("Project onto Active Fit"))
self.Bind(wx.EVT_MENU, self.OnProjectToFit, projectedItem)
commandItem = menu.Append(wx.ID_ANY, "Add Command Booster")
commandItem = menu.Append(wx.ID_ANY, _t("Add Command Booster"))
self.Bind(wx.EVT_MENU, self.OnAddCommandFit, commandItem)
self.PopupMenu(menu, pos)