Skip to content

Commit

Permalink
i18n/zh_CN: update zh_CN translation for lots of StatsViews
Browse files Browse the repository at this point in the history
(cherry picked from commit bdac2f8)
  • Loading branch information
zhaoweny authored and blitzmann committed Jun 20, 2020
1 parent 343f4a5 commit 2d3a661
Show file tree
Hide file tree
Showing 12 changed files with 432 additions and 83 deletions.
2 changes: 1 addition & 1 deletion gui/additionsPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def select(self, name, focus=True):
self.notebook.SetSelection(self.PANES.index(name), focus=focus)

def getName(self, idx):
return _(self.PANES[idx])
return self.PANES[idx]

def ToggleContent(self, event):
TogglePanel.ToggleContent(self, event)
Expand Down
14 changes: 7 additions & 7 deletions gui/builtinStatsViews/capacitorViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, parent):
self.parent = parent

def getHeaderText(self, fit):
return "Capacitor"
return _("Capacitor")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand All @@ -52,7 +52,7 @@ def populatePanel(self, contentPanel, headerPanel):

sizerCapacitor.Add(baseBox, 0, wx.ALIGN_LEFT)
bitmap = BitmapLoader.getStaticBitmap("capacitorInfo_big", parent, "gui")
tooltip = wx.ToolTip("Capacitor stability")
tooltip = wx.ToolTip(_("Capacitor stability"))
bitmap.SetToolTip(tooltip)
baseBox.Add(bitmap, 0, wx.ALIGN_CENTER)

Expand All @@ -62,7 +62,7 @@ def populatePanel(self, contentPanel, headerPanel):
hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 0, wx.ALIGN_LEFT)

hbox.Add(wx.StaticText(parent, wx.ID_ANY, "Total: "), 0, wx.ALIGN_LEFT | wx.LEFT, 3)
hbox.Add(wx.StaticText(parent, wx.ID_ANY, _("Total: ")), 0, wx.ALIGN_LEFT | wx.LEFT, 3)
lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
setattr(self, "label%sCapacitorCapacity" % panel.capitalize(), lbl)
hbox.Add(lbl, 0, wx.ALIGN_LEFT)
Expand All @@ -72,11 +72,11 @@ def populatePanel(self, contentPanel, headerPanel):
hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 0, wx.ALIGN_LEFT)

lbl = wx.StaticText(parent, wx.ID_ANY, "Lasts ")
lbl = wx.StaticText(parent, wx.ID_ANY, _("Lasts "))
hbox.Add(lbl, 0, wx.ALIGN_LEFT | wx.LEFT, 3)
setattr(self, "label%sCapacitorState" % panel.capitalize(), lbl)

lbl = wx.StaticText(parent, wx.ID_ANY, "0s")
lbl = wx.StaticText(parent, wx.ID_ANY, _("0s"))
setattr(self, "label%sCapacitorTime" % panel.capitalize(), lbl)
hbox.Add(lbl, 0, wx.ALIGN_LEFT)

Expand All @@ -85,7 +85,7 @@ def populatePanel(self, contentPanel, headerPanel):

sizerCapacitor.Add(baseBox, 0, wx.ALIGN_CENTER_HORIZONTAL)

tooltip = wx.ToolTip("Extra stats")
tooltip = wx.ToolTip(_("Extra stats"))
bitmap = BitmapLoader.getStaticBitmap("capacitorRecharge_big", parent, "gui")
bitmap.SetToolTip(tooltip)
baseBox.Add(bitmap, 0, wx.ALIGN_CENTER)
Expand Down Expand Up @@ -166,7 +166,7 @@ def refreshPanel(self, fit):
else:
t = "%ds" % capState

s = "Stable: " if capStable else "Lasts "
s = _("Stable: ") if capStable else _("Lasts ")

getattr(self, lblNameTime % panel).SetLabel(t)
getattr(self, lblNameState % panel).SetLabel(s)
Expand Down
10 changes: 5 additions & 5 deletions gui/builtinStatsViews/firepowerViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, parent):
self._cachedValues = []

def getHeaderText(self, fit):
return "Firepower"
return _("Firepower")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand Down Expand Up @@ -71,7 +71,7 @@ def populatePanel(self, contentPanel, headerPanel):
box = wx.BoxSizer(wx.VERTICAL)
baseBox.Add(box, 0, wx.ALIGN_CENTER)

box.Add(wx.StaticText(parent, wx.ID_ANY, damageType.capitalize()), 0, wx.ALIGN_LEFT)
box.Add(wx.StaticText(parent, wx.ID_ANY, _(damageType).capitalize()), 0, wx.ALIGN_LEFT)

hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 1, wx.ALIGN_CENTER)
Expand All @@ -95,22 +95,22 @@ def populatePanel(self, contentPanel, headerPanel):

lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
setattr(self, "label%sVolleyTotal" % panel.capitalize(), lbl)
gridS.Add(wx.StaticText(parent, wx.ID_ANY, " Volley: "), 0, wx.ALL | wx.ALIGN_RIGHT)
gridS.Add(wx.StaticText(parent, wx.ID_ANY, _(" Volley: ")), 0, wx.ALL | wx.ALIGN_RIGHT)
gridS.Add(lbl, 0, wx.ALIGN_LEFT)

self._cachedValues.append(0)

lbl = wx.StaticText(parent, wx.ID_ANY, "0.0")
setattr(self, "label%sDpsTotal" % panel.capitalize(), lbl)
gridS.Add(wx.StaticText(parent, wx.ID_ANY, " DPS: "), 0, wx.ALL | wx.ALIGN_RIGHT)
gridS.Add(wx.StaticText(parent, wx.ID_ANY, _(" DPS: ")), 0, wx.ALL | wx.ALIGN_RIGHT)

self._cachedValues.append(0)

gridS.Add(lbl, 0, wx.ALIGN_LEFT)

image = BitmapLoader.getBitmap("mining_small", "gui")
self.miningyield = wx.BitmapButton(contentPanel, -1, image)
self.miningyield.SetToolTip(wx.ToolTip("Click to toggle to Mining Yield "))
self.miningyield.SetToolTip(wx.ToolTip(_("Click to toggle to Mining Yield ")))
self.miningyield.Bind(wx.EVT_BUTTON, self.switchToMiningYieldView)
sizerFirepower.Add(self.miningyield, 0, wx.ALIGN_LEFT)

Expand Down
8 changes: 4 additions & 4 deletions gui/builtinStatsViews/miningyieldViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, parent):
self._cachedValues = []

def getHeaderText(self, fit):
return "Mining Yield"
return _("Mining Yield")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand Down Expand Up @@ -64,7 +64,7 @@ def populatePanel(self, contentPanel, headerPanel):
box = wx.BoxSizer(wx.VERTICAL)
baseBox.Add(box, 0, wx.ALIGN_CENTER)

box.Add(wx.StaticText(parent, wx.ID_ANY, miningType.capitalize()), 0, wx.ALIGN_LEFT)
box.Add(wx.StaticText(parent, wx.ID_ANY, _(miningType).capitalize()), 0, wx.ALIGN_LEFT)

hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 1, wx.ALIGN_CENTER)
Expand All @@ -85,7 +85,7 @@ def populatePanel(self, contentPanel, headerPanel):
box = wx.BoxSizer(wx.VERTICAL)
baseBox.Add(box, 0, wx.EXPAND)

box.Add(wx.StaticText(parent, wx.ID_ANY, "Total"), 0, wx.ALIGN_LEFT)
box.Add(wx.StaticText(parent, wx.ID_ANY, _("Total")), 0, wx.ALIGN_LEFT)

hbox = wx.BoxSizer(wx.HORIZONTAL)
box.Add(hbox, 1, wx.EXPAND)
Expand All @@ -98,7 +98,7 @@ def populatePanel(self, contentPanel, headerPanel):

image = BitmapLoader.getBitmap("turret_small", "gui")
firepower = wx.BitmapButton(contentPanel, -1, image)
firepower.SetToolTip(wx.ToolTip("Click to toggle to Firepower View"))
firepower.SetToolTip(wx.ToolTip(_("Click to toggle to Firepower View")))
firepower.Bind(wx.EVT_BUTTON, self.switchToFirepowerView)
sizerMiningYield.Add(firepower, 0, wx.ALIGN_LEFT)

Expand Down
2 changes: 1 addition & 1 deletion gui/builtinStatsViews/outgoingViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, parent):
self._cachedValues = []

def getHeaderText(self, fit):
return "Remote Reps"
return _("Remote Reps")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinStatsViews/outgoingViewMinimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, parent):
self._cachedValues = []

def getHeaderText(self, fit):
return "Remote Reps"
return _("Remote Reps")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand Down
2 changes: 1 addition & 1 deletion gui/builtinStatsViews/priceViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, parent):
self.settings = MarketPriceSettings.getInstance()

def getHeaderText(self, fit):
return "Price"
return _("Price")

def populatePanel(self, contentPanel, headerPanel):
contentSizer = contentPanel.GetSizer()
Expand Down
14 changes: 7 additions & 7 deletions gui/builtinStatsViews/rechargeViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, parent):
self.mainFrame.Bind(GE.EFFECTIVE_HP_TOGGLED, self.toggleEffective)

def getHeaderText(self, fit):
return "Recharge rates"
return _("Recharge rates")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand Down Expand Up @@ -70,19 +70,19 @@ def populatePanel(self, contentPanel, headerPanel):
# Add an empty label first for correct alignment.
sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0)
toolTipText = {
"shieldPassive": "Passive shield recharge",
"shieldActive": "Active shield boost",
"armorActive": "Armor repair amount",
"hullActive": "Hull repair amount"}
"shieldPassive": _("Passive shield recharge"),
"shieldActive": _("Active shield boost"),
"armorActive": _("Armor repair amount"),
"hullActive": _("Hull repair amount")}
for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"):
bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui")
tooltip = wx.ToolTip(toolTipText[tankType])
bitmap.SetToolTip(tooltip)
sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)

toolTipText = {
"reinforced": "Reinforced",
"sustained": "Sustained"}
"reinforced": _("Reinforced"),
"sustained": _("Sustained")}
for stability in ("reinforced", "sustained"):
bitmap = BitmapLoader.getStaticBitmap("regen%s_big" % stability.capitalize(), contentPanel, "gui")
tooltip = wx.ToolTip(toolTipText[stability])
Expand Down
24 changes: 16 additions & 8 deletions gui/builtinStatsViews/resistancesViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self, parent):
self.mainFrame.Bind(GE.EFFECTIVE_HP_TOGGLED, self.ehpSwitch)

def getHeaderText(self, fit):
return "Resistances"
return _("Resistances")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand Down Expand Up @@ -79,16 +79,20 @@ def populatePanel(self, contentPanel, headerPanel):
# Add an empty label, then the rest.
sizerResistances.Add(wx.StaticText(contentPanel, wx.ID_ANY), wx.GBPosition(row, col), wx.GBSpan(1, 1))
col += 1
toolTipText = {"em": "Electromagnetic resistance", "thermal": "Thermal resistance",
"kinetic": "Kinetic resistance", "explosive": "Explosive resistance"}
toolTipText = {
"em" : _("Electromagnetic resistance"),
"thermal" : _("Thermal resistance"),
"kinetic" : _("Kinetic resistance"),
"explosive": _("Explosive resistance")
}
for damageType in ("em", "thermal", "kinetic", "explosive"):
bitmap = BitmapLoader.getStaticBitmap("%s_big" % damageType, contentPanel, "gui")
tooltip = wx.ToolTip(toolTipText[damageType])
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.SetToolTip(wx.ToolTip("Click to toggle between effective HP and raw HP"))
self.stEHPs.SetToolTip(wx.ToolTip(_("Click to toggle between effective HP and raw HP")))

self.stEHPs.Bind(wx.EVT_BUTTON, self.toggleEHP)

Expand All @@ -102,8 +106,12 @@ def populatePanel(self, contentPanel, headerPanel):
gaugeColours = (((38, 133, 198), (52, 86, 98)), ((198, 38, 38), (83, 65, 67)), ((163, 163, 163), (74, 90, 93)),
((198, 133, 38), (81, 83, 67)))

toolTipText = {"shield": "Shield resistance", "armor": "Armor resistance", "hull": "Hull resistance",
"damagePattern": "Incoming damage pattern"}
toolTipText = {
"shield" : _("Shield resistance"),
"armor" : _("Armor resistance"),
"hull" : _("Hull resistance"),
"damagePattern": _("Incoming damage pattern")
}
for tankType in ("shield", "armor", "hull", "separator", "damagePattern"):
if tankType != "separator":
bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui")
Expand Down Expand Up @@ -156,7 +164,7 @@ def populatePanel(self, contentPanel, headerPanel):
row += 1
col = 0

self.stEHPs.SetToolTip(wx.ToolTip("Click to toggle between effective HP and raw HP"))
self.stEHPs.SetToolTip(wx.ToolTip(_("Click to toggle between effective HP and raw HP")))

def toggleEHP(self, event):
wx.PostEvent(self.mainFrame, GE.EffectiveHpToggled(effective=self.stEHPs.GetLabel() == "HP"))
Expand Down Expand Up @@ -200,7 +208,7 @@ def refreshPanel(self, fit):
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("%s: %d\nResist Multiplier: x%.2f" % (tankType.capitalize(), ehp[tankType], rrFactor)))
else:
lbl.SetLabel("0")

Expand Down
27 changes: 20 additions & 7 deletions gui/builtinStatsViews/resourcesViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def toggleContext(self, context):
self.headerPanel.Layout()

def getHeaderText(self, fit):
return "Resources"
return _("Resources")

def getTextExtentW(self, text):
width, height = self.parent.GetTextExtent(text)
Expand All @@ -105,8 +105,13 @@ def populatePanel(self, contentPanel, headerPanel):
base = sizerResources
sizer.AddStretchSpacer()
# Turrets & launcher hardslots display
tooltipText = {"turret": "Turret hardpoints", "launcher": "Launcher hardpoints", "drones": "Drones active",
"fighter": "Fighter squadrons active", "calibration": "Calibration"}
tooltipText = {
"turret" : _("Turret hardpoints"),
"launcher" : _("Launcher hardpoints"),
"drones" : _("Drones active"),
"fighter" : _("Fighter squadrons active"),
"calibration": _("Calibration")
}
for type_ in ("turret", "launcher", "drones", "fighter", "calibration"):
box = wx.BoxSizer(wx.HORIZONTAL)

Expand All @@ -118,8 +123,10 @@ def populatePanel(self, contentPanel, headerPanel):

sizer.Add(box, 0, wx.ALIGN_CENTER)

suffix = {'turret': 'Hardpoints', 'launcher': 'Hardpoints', 'drones': 'Active', 'fighter': 'Tubes',
'calibration': 'Points'}
suffix = {
'turret' : 'Hardpoints', 'launcher': 'Hardpoints', 'drones': 'Active', 'fighter': 'Tubes',
'calibration': 'Points'
}
lbl = wx.StaticText(parent, wx.ID_ANY, "0")
setattr(self, "label%sUsed%s%s" % (panel.capitalize(), type_.capitalize(), suffix[type_].capitalize()), lbl)
box.Add(lbl, 0, wx.ALIGN_CENTER | wx.LEFT, 5)
Expand All @@ -140,8 +147,14 @@ def populatePanel(self, contentPanel, headerPanel):
gauge_font = wx.Font(fonts.NORMAL, wx.SWISS, wx.NORMAL, wx.NORMAL, False)

# PG, Cpu & drone stuff
tooltipText = {"cpu": "CPU", "pg": "PowerGrid", "droneBay": "Drone bay", "fighterBay": "Fighter bay",
"droneBandwidth": "Drone bandwidth", "cargoBay": "Cargo bay"}
tooltipText = {
"cpu" : _("CPU"),
"pg" : _("PowerGrid"),
"droneBay" : _("Drone bay"),
"fighterBay" : _("Fighter bay"),
"droneBandwidth": _("Drone bandwidth"),
"cargoBay" : _("Cargo bay")
}
for i, group in enumerate((("cpu", "pg"), ("cargoBay", "droneBay", "fighterBay", "droneBandwidth"))):
main = wx.BoxSizer(wx.VERTICAL)
base.Add(main, 1, wx.ALIGN_CENTER)
Expand Down
Loading

0 comments on commit 2d3a661

Please sign in to comment.