Skip to content

Commit

Permalink
Merge pull request #2222 from zhaoweny/i18n
Browse files Browse the repository at this point in the history
i18n: more annotation, more translation
  • Loading branch information
blitzmann authored Jul 11, 2020
2 parents 7667443 + 04f9c1c commit 9895339
Show file tree
Hide file tree
Showing 10 changed files with 1,290 additions and 356 deletions.
240 changes: 129 additions & 111 deletions eos/saveddata/damagePattern.py

Large diffs are not rendered by default.

324 changes: 165 additions & 159 deletions eos/saveddata/targetProfile.py

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion gui/builtinContextMenus/damagePatternChange.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from service.damagePattern import DamagePattern as DmgPatternSvc
from service.fit import Fit

_t = wx.GetTranslation


class ChangeDamagePattern(ContextMenuUnconditional):

Expand Down Expand Up @@ -43,8 +45,10 @@ def getText(self, callingWindow, itmContext):
for pattern in self.patterns:
container = self.items
for categoryName in pattern.hierarchy:
categoryName = _t(categoryName) if pattern.builtin else categoryName
container = container[1].setdefault(categoryName, (OrderedDict(), OrderedDict()))
container[0][pattern.shortName] = pattern
shortName = _t(pattern.shortName) if pattern.builtin else pattern.shortName
container[0][shortName] = pattern

return list(self.items[0].keys()) + list(self.items[1].keys())

Expand Down
4 changes: 3 additions & 1 deletion gui/builtinContextMenus/targetProfile/adder.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
for profile in profiles:
container = items
for categoryName in profile.hierarchy:
categoryName = _t(categoryName) if profile.builtin else categoryName
container = container[1].setdefault(categoryName, (OrderedDict(), OrderedDict()))
container[0][profile.shortName] = profile
shortName = _t(profile.shortName) if profile.builtin else profile.shortName
container[0][shortName] = profile

# Category as menu item - expands further
msw = "wxMSW" in wx.PlatformInfo
Expand Down
4 changes: 3 additions & 1 deletion gui/builtinContextMenus/targetProfile/switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
for profile in profiles:
container = items
for categoryName in profile.hierarchy:
categoryName = _t(categoryName) if profile.builtin else categoryName
container = container[1].setdefault(categoryName, (OrderedDict(), OrderedDict()))
container[0][profile.shortName] = profile
shortName = _t(profile.shortName) if profile.builtin else profile.shortName
container[0][shortName] = profile

# Category as menu item - expands further
msw = "wxMSW" in wx.PlatformInfo
Expand Down
10 changes: 5 additions & 5 deletions gui/builtinStatsViews/targetingMiscViewMinimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ def refreshPanel(self, fit):
ecmChance = otherValues["jamChance"]
ecmChance = round(ecmChance, 1)
if ecmChance > 0:
label.SetToolTip(wx.ToolTip(
_t("Type: {0}\n").foramt(fit.scanType) + "{}%".format(formatAmount(ecmChance, 3, 0, 0)) + _t(" chance to be jammed").format(
formatAmount(ecmChance, 3, 0, 0))))
label.SetToolTip(wx.ToolTip(_t("Type: {0}\n").foramt(fit.scanType) +
# xgettext:no-python-format,python-brace-format
_t("{}% chance to be jammed").format(formatAmount(ecmChance, 3, 0, 0))))
else:
label.SetToolTip(wx.ToolTip(_t("Type: {}").format(fit.scanType)))
elif labelName == "labelFullAlignTime":
Expand All @@ -226,7 +226,7 @@ def refreshPanel(self, fit):
agility = _t("Agility:\t%.3fx") % (fit.ship.getModifiedItemAttr("agility") or 0)
label.SetToolTip(wx.ToolTip("%s\n%s\n%s" % (alignTime, mass, agility)))
elif labelName == "labelFullCargo":
tipLines = [_t("Cargohold: ")+"{:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
tipLines = [_t("Cargohold: ") + "{:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, newValues["main"])]
for attrName, tipAlias in list(cargoNamesOrder.items()):
if newValues[attrName] > 0:
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, newValues[attrName]))
Expand All @@ -251,7 +251,7 @@ def refreshPanel(self, fit):
cachedCargo = self._cachedValues[counter]
# if you add stuff to cargo, the capacity doesn't change and thus it is still cached
# This assures us that we force refresh of cargo tooltip
tipLines = [_t("Cargohold: ")+"{:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
tipLines = [_t("Cargohold: ") + "{:,.2f}m\u00B3 / {:,.2f}m\u00B3".format(fit.cargoBayUsed, cachedCargo["main"])]
for attrName, tipAlias in list(cargoNamesOrder.items()):
if cachedCargo[attrName] > 0:
tipLines.append("{}: {:,.2f}m\u00B3".format(tipAlias, cachedCargo[attrName]))
Expand Down
3 changes: 2 additions & 1 deletion gui/builtinViewColumns/baseName.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def __init__(self, fittingView, params):
FittingSlot.MED: _t('Med'),
FittingSlot.LOW: _t('Low'),
FittingSlot.SUBSYSTEM: _t('Subsystem'),
FittingSlot.RIG: _t('Rig')
FittingSlot.RIG: _t('Rig'),
FittingSlot.SERVICE: _t('Service')
}


Expand Down
24 changes: 13 additions & 11 deletions gui/pyfa_gauge.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from gui.utils import anim_effects, color as color_utils, draw


_t = wx.GetTranslation

class PyGauge(wx.Window):
def __init__(self, parent, font, max_range=100, size=(-1, 30), *args,
**kargs):
Expand Down Expand Up @@ -326,33 +328,33 @@ def OnPaint(self, event):
r.top += 1

if self._max_range == 0.01 and self._value > 0:
format = u'\u221e' # infinity symbol
format_ = u'\u221e' # infinity symbol
# drop shadow
dc.SetTextForeground(wx.Colour(80, 80, 80)) # dark grey
dc.DrawLabel(format, r, wx.ALIGN_CENTER)
dc.DrawLabel(format_, r, wx.ALIGN_CENTER)
# text
dc.SetTextForeground(wx.WHITE)
dc.DrawLabel(format, rect, wx.ALIGN_CENTER)
dc.DrawLabel(format_, rect, wx.ALIGN_CENTER)
else:
if not self.GetBarColour() and self._show_remaining:
# we only do these for gradients with mouse over
range = self._max_range if self._max_range > 0.01 else 0
value = range - self._value
range_ = self._max_range if self._max_range > 0.01 else 0
value = range_ - self._value
if value < 0:
label = "over"
format_ = _t("{{0:.{0}f}} over").format(self._fraction_digits)
value = -value
else:
label = "left"
format = "{0:." + str(self._fraction_digits) + "f} " + label
format_ = _t("{{0:.{0}f}} left").format(self._fraction_digits)

else:
format = "{0:." + str(self._fraction_digits) + "f}%"
format_ = "{{0:.{0}f}}%".format(str(self._fraction_digits))

# drop shadow
dc.SetTextForeground(wx.Colour(80, 80, 80))
dc.DrawLabel(format.format(value), r, wx.ALIGN_CENTER)
dc.DrawLabel(format_.format(value), r, wx.ALIGN_CENTER)
# text
dc.SetTextForeground(wx.WHITE)
dc.DrawLabel(format.format(value), rect, wx.ALIGN_CENTER)
dc.DrawLabel(format_.format(value), rect, wx.ALIGN_CENTER)

def OnTimer(self, event):
old_value = self._old_percentage
Expand Down
Loading

0 comments on commit 9895339

Please sign in to comment.