From 77d233ca1c2ee240431e3af63b8b9adbdebff83c Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sun, 28 Jun 2020 13:38:33 -0400 Subject: [PATCH] Fix environmental variables for localizations --- gui/builtinContextMenus/envEffectAdd.py | 31 ++++++++++--------- locale/zh_CN/LC_MESSAGES/lang.po | 41 +++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/gui/builtinContextMenus/envEffectAdd.py b/gui/builtinContextMenus/envEffectAdd.py index 2ce0558c3..008eff847 100644 --- a/gui/builtinContextMenus/envEffectAdd.py +++ b/gui/builtinContextMenus/envEffectAdd.py @@ -102,13 +102,13 @@ class AddEnvironmentEffect(ContextMenuUnconditional): def getData(self): data = Group() - data.groups['Wormhole'] = self.getEffectBeacons( - 'Black Hole', 'Cataclysmic Variable', 'Magnetar', - 'Pulsar', 'Red Giant', 'Wolf Rayet') - data.groups['Sansha Incursion'] = self.getEffectBeacons('Sansha Incursion') - data.groups['Triglavian Invasion'] = self.getEffectBeacons('Triglavian Invasion') - data.groups['Triglavian Invasion'].groups['Destructible Beacons'] = self.getDestructibleBeacons() - data.groups['Abyssal Weather'] = self.getAbyssalWeather() + data.groups[_t('Wormhole')] = self.getEffectBeacons( + _t('Black Hole'), _t('Cataclysmic Variable'), _t('Magnetar'), + _t('Pulsar'), _t('Red Giant'), _t('Wolf Rayet')) + data.groups[_t('Sansha Incursion')] = self.getEffectBeacons(_t('Sansha Incursion')) + data.groups[_t('Triglavian Invasion')] = self.getEffectBeacons(_t('Triglavian Invasion')) + data.groups[_t('Triglavian Invasion')].groups[_t('Destructible Beacons')] = self.getDestructibleBeacons() + data.groups[_t('Abyssal Weather')] = self.getAbyssalWeather() return data def getEffectBeacons(self, *groups): @@ -122,7 +122,7 @@ class AddEnvironmentEffect(ContextMenuUnconditional): data = Group() # Stuff we don't want to see in names - garbages = ("System Effects", "Effects") + garbages = (_t("System Effects"), _t("Effects")) # Get group with all the system-wide beacons grp = sMkt.getGroup("Effect Beacon") @@ -182,21 +182,24 @@ class AddEnvironmentEffect(ContextMenuUnconditional): # Localized abyssal hazards items = sMkt.getGroup("Abyssal Hazards").items if items: - subdata = data.groups.setdefault('Localized', Group()) + subdata = data.groups.setdefault(_t('Localized'), Group()) for beacon in sMkt.getGroup("Abyssal Hazards").items: if not beacon.isType('projected'): continue - # Localized effects, currently, have a name like "(size) (type) Cloud" - # Until this inevitably changes, do a simple split - name_parts = beacon.typeName.split(" ") + groups = (_t('Bioluminescence'), _t('Caustic'), _t('Filament')) + for group in groups: + if re.search(group, beacon.name): + key = group + break + else: + continue - key = name_parts[1].strip() subsubdata = subdata.groups.setdefault(key, Group()) subsubdata.items.append(Entry(beacon.ID, beacon.name, beacon.name)) subdata.sort() # PVP weather - data.items.append(Entry(49766, 'PvP Weather', 'PvP Weather')) + data.items.append(Entry(49766, _t('PvP Weather'), _t('PvP Weather'))) return data diff --git a/locale/zh_CN/LC_MESSAGES/lang.po b/locale/zh_CN/LC_MESSAGES/lang.po index 6510dc2f7..7565164fb 100644 --- a/locale/zh_CN/LC_MESSAGES/lang.po +++ b/locale/zh_CN/LC_MESSAGES/lang.po @@ -2508,3 +2508,44 @@ msgstr "复制{}" #: gui/builtinContextMenus/itemStats.py:38 msgid "{} Stats" msgstr "{}属性" + +# These aren't typical translations. They need to map exactly to sub strings of the item names in the database +# to produce the proper context menu tree for environmental effects +msgid "System Effects" +msgstr "星系效果" + +msgid "Effects" +msgstr "效果光束" + +msgid "Black Hole" +msgstr "黑洞" + +msgid "Cataclysmic Variable" +msgstr "激变变星" + +msgid "Magnetar" +msgstr "磁星" + +msgid "Pulsar" +msgstr "脉冲星" + +msgid "Red Giant" +msgstr "红巨星" + +msgid "Wolf Rayet" +msgstr "沃尔夫-拉叶星" + +msgid "Sansha Incursion" +msgstr "萨沙入侵" + +msgid "Triglavian Invasion" +msgstr "三神裔入侵" + +msgid "Bioluminescence" +msgstr "型生物荧光" + +msgid "Caustic" +msgstr "腐蚀" + +msgid "Filament" +msgstr "纤维" \ No newline at end of file