Merge pull request #2217 from zhaoweny/i18n

i18n: sort zh_CN translation, more zh_CN translation
This commit is contained in:
Ryan Holmes
2020-06-30 09:32:45 -04:00
committed by GitHub
15 changed files with 2430 additions and 2311 deletions

View File

@@ -160,7 +160,7 @@ class CommandView(d.Display):
self.fits.sort(key=self.fitSort)
stuff.extend(self.fits)
if not stuff:
stuff = [DummyEntry("Drag a fit to this area")]
stuff = [DummyEntry(_t("Drag a fit to this area"))]
self.update(stuff)
def click(self, event):

View File

@@ -35,6 +35,7 @@ from service.market import Market
FIGHTER_ORDER = ('Light Fighter', 'Heavy Fighter', 'Support Fighter')
_t = wx.GetTranslation
class FighterViewDrop(wx.DropTarget):
@@ -58,7 +59,7 @@ class FighterView(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, style=wx.TAB_TRAVERSAL)
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
self.labels = ["Light", "Heavy", "Support"]
self.labels = [("Light", _t("Light")), ("Heavy", _t("Heavy")), ("Support", _t("Support"))]
mainSizer = wx.BoxSizer(wx.VERTICAL)
@@ -68,18 +69,18 @@ class FighterView(wx.Panel):
textSizer = wx.BoxSizer(wx.HORIZONTAL)
textSizer.AddStretchSpacer()
for x in self.labels:
lbl = wx.StaticText(self, wx.ID_ANY, x.capitalize())
for attr, label in self.labels:
lbl = wx.StaticText(self, wx.ID_ANY, label)
textSizer.Add(lbl, 0, wx.ALIGN_CENTER | wx.LEFT, 5)
lbl = wx.StaticText(self, wx.ID_ANY, "0")
setattr(self, "label%sUsed" % (x.capitalize()), lbl)
setattr(self, "label%sUsed" % attr, lbl)
textSizer.Add(lbl, 0, wx.ALIGN_CENTER | wx.LEFT, 5)
textSizer.Add(wx.StaticText(self, wx.ID_ANY, "/"), 0, wx.ALIGN_CENTER)
lbl = wx.StaticText(self, wx.ID_ANY, "0")
setattr(self, "label%sTotal" % (x.capitalize()), lbl)
setattr(self, "label%sTotal" % attr, lbl)
textSizer.Add(lbl, 0, wx.ALIGN_CENTER)
textSizer.AddStretchSpacer()
@@ -100,7 +101,7 @@ class FighterView(wx.Panel):
fit = sFit.getFit(activeFitID)
if fit:
for x in self.labels:
for x, _ in self.labels:
if fit.isStructure:
slot = getattr(FittingSlot, "FS_{}".format(x.upper()))
else:

View File

@@ -32,6 +32,8 @@ from gui.utils.staticHelpers import DragDropHelper
from service.fit import Fit
from service.market import Market
_t = wx.GetTranslation
class ImplantViewDrop(wx.DropTarget):
def __init__(self, dropFn, *args, **kwargs):
@@ -62,8 +64,8 @@ class ImplantView(wx.Panel):
radioSizer = wx.BoxSizer(wx.HORIZONTAL)
radioSizer.AddStretchSpacer()
self.rbFit = wx.RadioButton(self, id=wx.ID_ANY, label="Use Fit-specific Implants", style=wx.RB_GROUP)
self.rbChar = wx.RadioButton(self, id=wx.ID_ANY, label="Use Character Implants")
self.rbFit = wx.RadioButton(self, id=wx.ID_ANY, label=_t("Use Fit-specific Implants"), style=wx.RB_GROUP)
self.rbChar = wx.RadioButton(self, id=wx.ID_ANY, label=_t("Use Character Implants"))
radioSizer.Add(self.rbFit, 0, wx.ALL, 5)
radioSizer.Add(self.rbChar, 0, wx.ALL, 5)
radioSizer.AddStretchSpacer()

View File

@@ -223,7 +223,7 @@ class ProjectedView(d.Display):
stuff.extend(self.drones)
stuff.extend(self.fighters)
if not stuff:
stuff = [DummyEntry('Drag an item or fit, or use right-click menu for wormhole effects')]
stuff = [DummyEntry(_t('Drag an item or fit, or use right-click menu for wormhole effects'))]
self.update(stuff)
def get(self, row):

View File

@@ -74,9 +74,9 @@ class ChangeAffectingSkills(ContextMenuSingle):
def addSkill(self, rootMenu, skill, i):
if i < 0:
label = "Not Learned"
label = _t("Not Learned")
else:
label = "Level %s" % i
label = _t("Level %s") % i
id = ContextMenuSingle.nextID()
self.skillIds[id] = (skill, i)

View File

@@ -6,6 +6,7 @@ from gui.builtinMarketBrowser.events import RECENTLY_USED_MODULES
from logbook import Logger
pyfalog = Logger(__name__)
_t = wx.GetTranslation
class MarketTree(wx.TreeCtrl):
@@ -33,7 +34,7 @@ class MarketTree(wx.TreeCtrl):
# Add recently used modules node
rumIconId = self.addImage("market_small", "gui")
self.AppendItem(self.root, "Recently Used Items", rumIconId, data=RECENTLY_USED_MODULES)
self.AppendItem(self.root, _t("Recently Used Items"), rumIconId, data=RECENTLY_USED_MODULES)
# Bind our lookup method to when the tree gets expanded
self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.expandLookup)

View File

@@ -396,7 +396,7 @@ class SkillTreeView(wx.Panel):
self.idUnlearned = wx.NewId()
self.levelIds = {}
self.idLevels = {}
self.levelIds[self.idUnlearned] = "Not learned"
self.levelIds[self.idUnlearned] = _t("Not learned")
for level in range(6):
id = wx.NewId()
self.levelIds[id] = level
@@ -529,7 +529,7 @@ class SkillTreeView(wx.Panel):
iconId = self.skillBookDirtyImageId
childId = tree.AppendItem(root, name, iconId, data=('skill', id))
tree.SetItemText(childId, 1, _t("Level {}d").format(int(level) if isinstance(level, float) else level))
tree.SetItemText(childId, 1, _t("Level {}d").format(int(level)) if isinstance(level, float) else level)
def populateSkillTree(self, event=None):
sChar = Character.getInstance()
@@ -588,7 +588,7 @@ class SkillTreeView(wx.Panel):
childId = tree.AppendItem(root, name, iconId, data=('skill', id))
tree.SetItemText(childId, 1, _t("Level {}").format(int(level) if isinstance(level, float) else level))
tree.SetItemText(childId, 1, _t("Level {}").format(int(level)) if isinstance(level, float) else level)
def spawnMenu(self, event):
item = event.GetItem()

View File

@@ -25,13 +25,12 @@ import wx
from eos.db import getFit
from gui.utils.clipboard import toClipboard
from service.const import PortMultiBuyOptions
from service.const import PortDnaOptions, PortEftOptions, PortMultiBuyOptions
from service.port import EfsPort, Port
from service.port.dna import DNA_OPTIONS
from service.port.eft import EFT_OPTIONS
from service.port.multibuy import MULTIBUY_OPTIONS
from service.settings import SettingsProvider
_t = wx.GetTranslation
class CopySelectDialog(wx.Dialog):
copyFormatEft = 0
@@ -43,15 +42,32 @@ class CopySelectDialog(wx.Dialog):
copyFormatFitStats = 6
def __init__(self, parent):
super().__init__(parent, id=wx.ID_ANY, title="Select a format", size=(-1, -1), style=wx.DEFAULT_DIALOG_STYLE)
self.MULTIBUY_OPTIONS = (
(PortMultiBuyOptions.LOADED_CHARGES, _t('Loaded Charges'), _t('Export charges loaded into modules'), True),
(PortMultiBuyOptions.IMPLANTS, _t('Implants'), _t('Export implants'), False),
(PortMultiBuyOptions.BOOSTERS, _t('Boosters'), _t('Export boosters'), False),
(PortMultiBuyOptions.CARGO, _t('Cargo'), _t('Export cargo contents'), True),
(PortMultiBuyOptions.OPTIMIZE_PRICES, _t('Optimize Prices'), _t('Replace items by cheaper alternatives'), False),
)
self.EFT_OPTIONS = (
(PortEftOptions.LOADED_CHARGES, _t('Loaded Charges'), _t('Export charges loaded into modules'), True),
(PortEftOptions.MUTATIONS, _t('Mutated Attributes'), _t('Export mutated modules\' stats'), True),
(PortEftOptions.IMPLANTS, _t('Implants'), _t('Export implants'), True),
(PortEftOptions.BOOSTERS, _t('Boosters'), _t('Export boosters'), True),
(PortEftOptions.CARGO, _t('Cargo'), _t('Export cargo hold contents'), True))
self.DNA_OPTIONS = (
(PortDnaOptions.FORMATTING, _t('Formatting Tags'), _t('Include formatting tags to paste fit directly into corp bulletins, MOTD, etc.'), True),
)
super().__init__(parent, id=wx.ID_ANY, title=_t("Select a format"), size=(-1, -1), style=wx.DEFAULT_DIALOG_STYLE)
self.CopySelectDict = {
CopySelectDialog.copyFormatEft : self.exportEft,
CopySelectDialog.copyFormatXml : self.exportXml,
CopySelectDialog.copyFormatDna : self.exportDna,
CopySelectDialog.copyFormatEsi : self.exportEsi,
CopySelectDialog.copyFormatEft: self.exportEft,
CopySelectDialog.copyFormatXml: self.exportXml,
CopySelectDialog.copyFormatDna: self.exportDna,
CopySelectDialog.copyFormatEsi: self.exportEsi,
CopySelectDialog.copyFormatMultiBuy: self.exportMultiBuy,
CopySelectDialog.copyFormatEfs : self.exportEfs,
CopySelectDialog.copyFormatEfs: self.exportEfs,
CopySelectDialog.copyFormatFitStats: self.exportFitStats
}
@@ -59,10 +75,10 @@ class CopySelectDialog(wx.Dialog):
mainSizer = wx.BoxSizer(wx.VERTICAL)
self.copyFormats = OrderedDict((
("EFT", (CopySelectDialog.copyFormatEft, EFT_OPTIONS)),
("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, MULTIBUY_OPTIONS)),
("EFT", (CopySelectDialog.copyFormatEft, self.EFT_OPTIONS)),
("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, self.MULTIBUY_OPTIONS)),
("ESI", (CopySelectDialog.copyFormatEsi, None)),
("DNA", (CopySelectDialog.copyFormatDna, DNA_OPTIONS)),
("DNA", (CopySelectDialog.copyFormatDna, self.DNA_OPTIONS)),
("EFS", (CopySelectDialog.copyFormatEfs, None)),
("Stats", (CopySelectDialog.copyFormatFitStats, None)),
# ("XML", (CopySelectDialog.copyFormatXml, None)),
@@ -196,4 +212,3 @@ class CopySelectDialog(wx.Dialog):
""" Puts fit stats in textual format into the clipboard """
fit = getFit(self.mainFrame.getActiveFit())
Port.exportFitStats(fit, callback)

View File

@@ -226,7 +226,7 @@ class ExportToEve(AuxiliaryFrame):
mainSizer.Add(hSizer, 0, wx.EXPAND, 5)
self.exportChargesCb = wx.CheckBox(self, wx.ID_ANY, 'Export Loaded Charges', wx.DefaultPosition, wx.DefaultSize, 0)
self.exportChargesCb = wx.CheckBox(self, wx.ID_ANY, _t('Export Loaded Charges'), wx.DefaultPosition, wx.DefaultSize, 0)
self.exportChargesCb.SetValue(EsiSettings.getInstance().get('exportCharges'))
self.exportChargesCb.Bind(wx.EVT_CHECKBOX, self.OnChargeExportChange)
mainSizer.Add(self.exportChargesCb, 0, 0, 5)

View File

@@ -12,7 +12,7 @@ For Linux and macOS users these tools might be available out-of-box.
### To generate new template for translation:
```console
$ find gui/ *.py -name "*.py" | xgettext --from-code=UTF-8 -o locale/lang.pot -d lang -k_t -f -
$ find gui/ *.py -name "*.py" | xgettext --from-code=UTF-8 -o locale/lang.pot -d lang -k_t -f - -s
```
explanation:
@@ -24,13 +24,14 @@ explanation:
* `-d lang`: default language domain is `lang`
* `-k_t`: besides default keyword (including `_`, see `info xgettext` for detail), also look for `_t`
* `-f -`: let `xgettext` to read from stdin, which is connected to `find` stdout
* `-s`: sort output according to `msgid`
this `locale/lang.pot` is called PO template, which is throwed away once actual `ll_CC/LC_MESSAGES/lang.po` is ready for use.
### To initialize PO file for new language
```console
$ msginit -i locale/lang.pot -l ll_CC -o locale/ll_CC/LC_MESSAGES/lang.po
$ msginit -i locale/lang.pot -l ll_CC -o locale/ll_CC/LC_MESSAGES/lang.po -s
```
explanation:
@@ -47,7 +48,7 @@ this `locale/ll_CC/LC_MESSAGES/lang.po` should be checked into VCS, later it wil
### To update PO file for existing translation
```console
$ msgmerge locale/ll_CC/LC_MESSAGES/lang.po locale/lang.pot
$ msgmerge -s locale/ll_CC/LC_MESSAGES/lang.po locale/lang.pot
```
### To do actual translation
@@ -69,6 +70,15 @@ for f in locale/*/; do
done
```
### To merge 2 or more PO file
```console
$ msgcat -s path/to/old.po [path/to/another.po] -o path/to/new.po
```
Note that `msgcat` cannot perform a 3-way merge, it will simply stack translations with same `msgid` on top of each other.
If you use `msgcat` to merge multiple PO file, please check and fix the output before commit to Git.
## i18n with Poedit
### To update PO file for existing translation

File diff suppressed because it is too large Load Diff

View File

@@ -42,7 +42,7 @@ from eos.const import FittingSlot as es_Slot
from eos.saveddata.fighter import Fighter as es_Fighter
pyfalog = Logger(__name__)
_t = wx.GetTranslation
class CharacterImportThread(threading.Thread):
@@ -319,7 +319,7 @@ class Character:
@staticmethod
def getSkillLevel(charID, skillID):
skill = eos.db.getCharacter(charID).getSkill(skillID)
return float(skill.level) if skill.learned else "Not learned", skill.isDirty
return float(skill.level) if skill.learned else _t("Not learned"), skill.isDirty
@staticmethod
def getDirtySkills(charID):

View File

@@ -39,10 +39,6 @@ from service.market import Market
pyfalog = Logger(__name__)
DNA_OPTIONS = (
(PortDnaOptions.FORMATTING, 'Formatting Tags', 'Include formatting tags to paste fit directly into corp bulletins, MOTD, etc.', True),
)
def importDna(string, fitName=None):
sMkt = Market.getInstance()

View File

@@ -43,15 +43,6 @@ from service.port.shared import IPortUser, fetchItem, processing_notify
pyfalog = Logger(__name__)
EFT_OPTIONS = (
(PortEftOptions.LOADED_CHARGES, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortEftOptions.MUTATIONS, 'Mutated Attributes', 'Export mutated modules\' stats', True),
(PortEftOptions.IMPLANTS, 'Implants', 'Export implants', True),
(PortEftOptions.BOOSTERS, 'Boosters', 'Export boosters', True),
(PortEftOptions.CARGO, 'Cargo', 'Export cargo hold contents', True))
MODULE_CATS = ('Module', 'Subsystem', 'Structure Module')
SLOT_ORDER = (FittingSlot.LOW, FittingSlot.MED, FittingSlot.HIGH, FittingSlot.RIG, FittingSlot.SUBSYSTEM, FittingSlot.SERVICE)
OFFLINE_SUFFIX = '/OFFLINE'

View File

@@ -22,15 +22,6 @@ from service.const import PortMultiBuyOptions
from service.price import Price as sPrc
MULTIBUY_OPTIONS = (
(PortMultiBuyOptions.LOADED_CHARGES, 'Loaded Charges', 'Export charges loaded into modules', True),
(PortMultiBuyOptions.IMPLANTS, 'Implants', 'Export implants', False),
(PortMultiBuyOptions.BOOSTERS, 'Boosters', 'Export boosters', False),
(PortMultiBuyOptions.CARGO, 'Cargo', 'Export cargo contents', True),
(PortMultiBuyOptions.OPTIMIZE_PRICES, 'Optimize Prices', 'Replace items by cheaper alternatives', False),
)
def exportMultiBuy(fit, options, callback):
itemAmounts = {}