ArtificialQualia / PyEveLiveDPS

PyEveLiveDPS (PELD) is a live DPS calculator and grapher for EVE Online
GNU General Public License v3.0
157 stars 27 forks source link

Add support for Chinese language (For Serenity players) #61

Closed cnlnpjhsy closed 4 years ago

cnlnpjhsy commented 4 years ago

Hi there, I met a introduction video about PELD several days ago in bilibili (A video site in China). The features are awesome but it's a pity that PELD cannot work while the EVE language is Chinese. Just motivated by passion (I'm just a freshman at college studying CS, and I even don't know how to write code in Python), I started localizing PELD and tried to make it work on Serenity. So far it looks like pretty well: 图片 ^I add a Chinese regex in logreader.py, thus PELD can read logs in Chinese 图片 ^Nearly all texts are localized. Chinese players can quickly get started with PELD. 图片 ^I even made a gif to introduce how to export overview settings

Except oreVolume.py and updateChecker.py nearly all texts are translated into Chinese. Some problems exist while localizing:

However this localized PELD is enough for us Chinese players to use. I would appreciate it so much if you can add a Chinese version! If so I will make a pull request later. (Sorry, not familar with Github!) Thanks again for your awesome PELD! Fly safe!

ArtificialQualia commented 4 years ago

Excellent work! Impressive you were able to navigate all that code without even knowing Python.

I think the first thing to do is merge your updated logreader.py. That should be easy to drop in without making large sweeping changes, and quickly provides value.

As for the localization of the language of the client, I'm not sure yet how to integrate that. I assume you edited the English lines in the code directly into Chinese? That works fine for doing a single release, but any new code that gets added would have to get re-implemented in both the Chinese and English code bases. Ideally for localization we would be using localization files or similar that abstract the text away from the code itself and just references the right strings to use depending on the language the user has chosen. Of course, I didn't have the foresight when I first started this project to do localization properly, but it isn't an insurmountable task.

Let me know when you get your code onto github and I can take a look.

cnlnpjhsy commented 4 years ago

62

Maybe I'm unable to fix the mining bug... Here is a mining log in Chinese, hope you can help :( [ 2020.07.30 12:19:52 ] (mining) <color=0x77ffffff>你开采了<b><font size=12><color=0xffaaaa00>65<color=0x77ffffff><font size=10>个单位的<color=0xffffffff><font size=12><b>凡晶石</b>

你开采了=You have mined 65=65 (Amount of ore) 个单位的=units of 凡晶石=Veldspar (Type of ore)

cnlnpjhsy commented 4 years ago

As you have guessed, I did edit English texts in the code directly. I know for sure that this is only an expediency and it's terrible when the code needs to be updated. Initially I only wanted to add Chinese regex so PELD could work with Serenity. For me this is enough, but I'd like to let more Chinese players know this project since few people know there's a DPS tracking tool in EVE. So I localized the client and I believe the localized version could be released to Chinese players now. Yeah, that means the localized client will never get updated, or that heavy, burdensome and repeated coding and translating work will be required when original English PELD gets updated. Thus I'm here looking forward to a better localization plan. 😁 Fortunately I'm in my summer vacation and I have lots of time to do some coding. Also I can learn something about Python :) P.S.: The coding language I have learned in college is C++

ArtificialQualia commented 4 years ago

With the issue with mining, I assume it is still reporting the number of units mined, just not the M3 correctly when that setting is used? If that is the case, it's because all of the Chinese names of the ores would have to be added to oreVolume.py. There are a lot of different ores, so it may be a pain to add that manually. Perhaps there is a Chinese language sql dump that can be used to extract that information? I believe that's how I originally got the list of English name ores and sizes.

cnlnpjhsy commented 4 years ago

I assume it is still reporting the number of units mined

图片

Well it just won't work :(

As to oreVolume.py, I will try to find a Chinese SQL to get the list, but whatever, that's not a big stuff

ArtificialQualia commented 4 years ago

Ah ok, I think I see the issue. Try replacing:

'mined': "\(mining\) .* <b><.*?><.*?>([0-9]+).*>个单位的.*<b>(.+)</b>"

With this:

'mined': "\(mining\) .*<b><.*?><.*?>([0-9]+).*>个单位的.*<b>(.+)</b>"

The Chinese logs appear to be missing a space that other log languages have. Removing that space should get it to work.

cnlnpjhsy commented 4 years ago

图片

Then it works! Thank you a lot. I replaced Veldspar with 凡晶石 and enabled M3 display, so it showed 6.5 correctly.

The pull request #62 has been updated.

cnlnpjhsy commented 4 years ago

65 Added Chinese ore names

I hate to do it but I translated ore names into Chinese MANUALLY. I did find a database, but the data there was too old to use. Whatever that's not a big stuff, just 1.5 hrs work. Now Chinese players can use M3 display.

ArtificialQualia commented 4 years ago

Well thanks for going the extra mile there to get those names!

I'll close this issue out for now since the primary reason it was opened is implemented.

66 has been opened for the ongoing work.