i18n: improve string literal annotations

1. annotate more strings for statsViews, itemStats
2. fix raw title and description for preferences
3. fix crash on opening AttributeEditor, characterEditor
This commit is contained in:
zhaoweny
2020-06-22 17:55:58 +08:00
parent 07696ce0ed
commit 889e901cbd
20 changed files with 69 additions and 67 deletions

View File

@@ -64,7 +64,7 @@ class FirepowerViewFull(StatsView):
counter = 0
for damageType, image in (("weapon", "turret"), ("drone", "droneDPS")):
for label, image, attr in ((_t("Weapon"), "turret", "Weapon"), (_t("Drone"), "droneDPS", "Drone")):
baseBox = wx.BoxSizer(wx.HORIZONTAL)
sizerFirepower.Add(baseBox, 1, wx.ALIGN_LEFT if counter == 0 else wx.ALIGN_CENTER_HORIZONTAL)
@@ -73,13 +73,13 @@ class FirepowerViewFull(StatsView):
box = wx.BoxSizer(wx.VERTICAL)
baseBox.Add(box, 0, wx.ALIGN_CENTER)
box.Add(wx.StaticText(parent, wx.ID_ANY, _t(damageType).capitalize()), 0, wx.ALIGN_LEFT)
box.Add(wx.StaticText(parent, wx.ID_ANY, label), 0, wx.ALIGN_LEFT)
hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 1, wx.ALIGN_CENTER)
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0 DPS")
setattr(self, "label%sDps%s" % (panel.capitalize(), damageType.capitalize()), lbl)
setattr(self, "label%sDps%s" % (panel.capitalize(), attr), lbl)
hbox.Add(lbl, 0, wx.ALIGN_CENTER)
self._cachedValues.append(0)
@@ -112,7 +112,7 @@ class FirepowerViewFull(StatsView):
image = BitmapLoader.getBitmap("mining_small", "gui")
self.miningyield = wx.BitmapButton(contentPanel, -1, image)
self.miningyield.SetToolTip(wx.ToolTip(_t("Click to toggle to Mining Yield ")))
self.miningyield.SetToolTip(wx.ToolTip(_t("Click to toggle to Mining Yield")))
self.miningyield.Bind(wx.EVT_BUTTON, self.switchToMiningYieldView)
sizerFirepower.Add(self.miningyield, 0, wx.ALIGN_LEFT)

View File

@@ -53,7 +53,10 @@ class PriceViewFull(StatsView):
gridPrice = wx.GridSizer(2, 3, 0, 0)
contentSizer.Add(gridPrice, 0, wx.EXPAND | wx.ALL, 0)
for _type in ("ship", "fittings", "character", "drones", "cargoBay", "total"):
for _type, label in (
("ship", _t("Ship")), ("fittings", _t("Fittings")), ("character", _t("Character")),
("drones", _t("Drones")), ("cargoBay", _t("Cargo bay")), ("total", _t("Total"))
):
if _type in "ship":
image = "ship_big"
elif _type in ("fittings", "total"):
@@ -69,7 +72,7 @@ class PriceViewFull(StatsView):
vbox = wx.BoxSizer(wx.VERTICAL)
box.Add(vbox, 1, wx.EXPAND)
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, _t(_type).capitalize()), 0, wx.ALIGN_LEFT)
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, label.capitalize()), 0, wx.ALIGN_LEFT)
hbox = wx.BoxSizer(wx.HORIZONTAL)
vbox.Add(hbox)

View File

@@ -53,7 +53,9 @@ class PriceViewMinimal(StatsView):
gridPrice = wx.GridSizer(1, 3, 0, 0)
contentSizer.Add(gridPrice, 0, wx.EXPAND | wx.ALL, 0)
for _type in ("ship", "fittings", "total"):
for _type, label in (
("ship", _t("Ship")), ("fittings", _t("Fittings")), ("total", _t("Total"))
):
image = "%sPrice_big" % _type if _type != "ship" else "ship_big"
box = wx.BoxSizer(wx.HORIZONTAL)
gridPrice.Add(box, 0, wx.ALIGN_TOP)
@@ -63,7 +65,7 @@ class PriceViewMinimal(StatsView):
vbox = wx.BoxSizer(wx.VERTICAL)
box.Add(vbox, 1, wx.EXPAND)
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, _t(_type).capitalize()), 0, wx.ALIGN_LEFT)
vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, label), 0, wx.ALIGN_LEFT)
hbox = wx.BoxSizer(wx.HORIZONTAL)
vbox.Add(hbox)

View File

@@ -58,7 +58,7 @@ class ResistancesViewFull(StatsView):
# Custom header EHP
headerContentSizer = self.headerPanel.Parent.GetHeaderContentSizer()
self.stEff = wx.StaticText(headerPanel, wx.ID_ANY, "(" + _t("Effective HP") + ": ")
self.stEff = wx.StaticText(headerPanel, wx.ID_ANY, "(" + _t("Effective HP: "))
headerContentSizer.Add(self.stEff)
headerPanel.GetParent().AddToggleItem(self.stEff)
@@ -93,7 +93,7 @@ class ResistancesViewFull(StatsView):
bitmap.SetToolTip(tooltip)
sizerResistances.Add(bitmap, wx.GBPosition(row, col), wx.GBSpan(1, 1), wx.ALIGN_CENTER)
col += 1
self.stEHPs = wx.Button(contentPanel, style=wx.BU_EXACTFIT, label="EHP")
self.stEHPs = wx.Button(contentPanel, style=wx.BU_EXACTFIT, label=_t("EHP"))
self.stEHPs.SetToolTip(wx.ToolTip(_t("Click to toggle between effective HP and raw HP")))
self.stEHPs.Bind(wx.EVT_BUTTON, self.toggleEHP)
@@ -184,7 +184,7 @@ class ResistancesViewFull(StatsView):
wx.PostEvent(self.mainFrame, GE.EffectiveHpToggled(effective=True))
return
self.stEHPs.SetLabel("EHP" if self.showEffective else "HP")
self.stEHPs.SetLabel(_t("EHP") if self.showEffective else _t("HP"))
self.activeFit = fit.ID if fit is not None else None
for tankType in ("shield", "armor", "hull"):
@@ -203,24 +203,24 @@ class ResistancesViewFull(StatsView):
ehp = (fit.ehp if self.showEffective else fit.hp) if fit is not None else None
total = 0
for tankType in ("shield", "armor", "hull"):
for tankType, tooltip in (("shield", _t("Shield: ")), ("armor", _t("Armor: ")), ("hull", _t("Hull: "))):
lbl = getattr(self, "labelResistance%sEhp" % tankType.capitalize())
if ehp is not None:
total += ehp[tankType]
rrFactor = fit.ehp[tankType] / fit.hp[tankType]
lbl.SetLabel(formatAmount(ehp[tankType], 3, 0, 9))
lbl.SetToolTip(
wx.ToolTip("%s: %d\nResist Multiplier: x%.2f" % (tankType.capitalize(), ehp[tankType], rrFactor)))
wx.ToolTip(tooltip + "%d\n" % ehp[tankType] + _t("Resist Multiplier: ") + "%.2fx" % rrFactor))
else:
lbl.SetLabel("0")
self.labelEhp.SetLabel("%s" % formatAmount(total, 3, 0, 9))
if self.showEffective:
self.stEff.SetLabel("( Effective HP: ")
self.labelEhp.SetToolTip(wx.ToolTip("Effective: %d HP" % total))
self.stEff.SetLabel("(" + _t("Effective HP: "))
self.labelEhp.SetToolTip(wx.ToolTip(_t("Effective: %d HP") % total))
else:
self.stEff.SetLabel("( Raw HP: ")
self.labelEhp.SetToolTip(wx.ToolTip("Raw: %d HP" % total))
self.stEff.SetLabel("(" + _t("Raw HP: "))
self.labelEhp.SetToolTip(wx.ToolTip(_t("Raw: %d HP") % total))
damagePattern = fit.damagePattern if fit is not None and self.showEffective else None
total = sum((damagePattern.emAmount, damagePattern.thermalAmount,