Pyfa icon indicating copy to clipboard operation
Pyfa copied to clipboard

Possibility of Add Multi-language Support

Open BikerDuality opened this issue 7 years ago • 17 comments

Many chinese players are difficult to read English. So,"Air Dragon" did this chinese version by edit the "eve.db". eve.zip I want to ask is there any possibility to add multi-language support. "Air Dragon"said:"Add multi-language support did not need too much change. "

BikerDuality avatar May 08 '18 14:05 BikerDuality

It is not too difficult to swap out the english language for another language for EVE data like ships and modules. I simply have to tell my data script which language to use.

The difficult part is to have both English and Chinese (or Russian, Spanish, etc) available in the same database - that would be a big undertaking. A bigger undertaking would be to also have the pyfa UI translated.

These are things that I wish to look into eventually, something like having the ability to download and "install" a language pack. This would be very new territory for me, so if anyone has experience and wishes to help, please get in touch and we can discuss :)

I will also look into stop gap measures such as making available for download an eve.db for a specific language.

blitzmann avatar May 08 '18 21:05 blitzmann

Also, I would be careful using a database that was translated. There are certain things within pyfa that are hardcoded in english that might not work with a translated database (things like Group names, certain item names, etc) :)

blitzmann avatar May 08 '18 21:05 blitzmann

Hello, I'm the "Air Dragon" he mentioned. I want to help you to finish the multi-language function.


I think it is not suitable to translate `eve.db` to specific version. It would cause some problem: 1. The translation of Special Edition Ship will cause a crash on start. 2. The translation of Skills would cause a crash on adding a fitting. 3. Translated items can not be searched. 4. Other problems I have not find. The translation of `eve.db` is just a experiment, not a eventually way to address it.
I suggest to seprate `process` and `show`. `process` in English and `show` in specific language. The language pack is just a table of translation of strings. When we want to display a string, we search in the table, if exsit, translate it. Although it is a hard coding, we can change it little by little. The unmodified part will display in English instead of a total crash.

GuoHaoxuan avatar May 09 '18 06:05 GuoHaoxuan

I suggest to seprate process and show. process in English and show in specific language. The language pack is just a table of translation of strings. When we want to display a string, we search in the table, if exsit, translate it. Although it is a hard coding, we can change it little by little. The unmodified part will display in English instead of a total crash.

Agreed, we should keep the english names regardless for things like that. One things that I want to look at is how much more bloated adding language support would make the database. If it's not too bad, this becomes much easier (can create a new property on the object display_name or something that would automatically lookup the proper translation). If adding language support is going to cause a huge bloat, we may have to tinker with something else, like an optional database file that can be downloaded and possibly use a sqlite ATTACH command, or maybe a eve.db made specifically for each language that can be downloaded that only contains the english and translated names (as opposed to all translation names). :/

Let me noodle on this a bit. I have a few other fires to put out with the 2.0 release, but I'm very intrigued by this, and want to hash out a bit of the requirements before I give too much direction.

blitzmann avatar May 09 '18 14:05 blitzmann

I sent a pull request for a very beginning version of it. @blitzmann

GuoHaoxuan avatar May 16 '18 03:05 GuoHaoxuan

@icyskyair thanks. I left some comments on the PR.

As stated on the PR, I think you should witch over to pythons localization support instead of rolling your own - it'll hopefully provide a bit more flexibility. Additionally, we should only focus on the UI for now while we figure out a good way to handle the eve data.

blitzmann avatar May 19 '18 20:05 blitzmann

When adding multi-language support, please add Serenity server ESI support in China.

KagurazakaNyaa avatar Dec 02 '18 02:12 KagurazakaNyaa

@XiLingHost

When adding multi-language support, please add Serenity server ESI support in China.

Not sure if I could even test this, as I don't have an account on serenity. How can I get an account there? Probably a better option would be to have a Chinese developer implement crude support for this as they'll be able to test and develop it easier. Probably a command switch when starting the program...

blitzmann avatar Dec 02 '18 21:12 blitzmann

I don't even know if serenity is updated for ESI, tbh. It's not a server option in https://esi.evetech.net/ui/

blitzmann avatar Dec 02 '18 21:12 blitzmann

I don't even know if serenity is updated for ESI, tbh. It's not a server option in https://esi.evetech.net/ui/

Serenity is now operated by a Chinese company called Netease and is undergoing testing. I asked their staff, they said that SSO has not been open yet.

Serenity's ESI address is https://esi.evepc.163.com/ui/

KagurazakaNyaa avatar Dec 04 '18 03:12 KagurazakaNyaa

Hi all, The serenity server is online! And I have already seen some chinese localizations on Pyfa. However they are maintained by individuals and distributed unofficially (bugs/old version). Could you consider adding a Chinese version. https://github.com/MiserereM/pyfa_zh/releases/tag/430 here is one Chinese localization. The bugs I have found for now:

  1. Can't search fitting and ships with Chinese(equipments are fine)
  2. Can't select enemy type in DPS part.

Best

Quadrifoglio-Sha avatar May 10 '20 23:05 Quadrifoglio-Sha

@Quadrifoglio-Sha welcome!

Localization is a huge task. If we were to do it, we would want to do it correctly so that it's easy to tweak / fix as needed. On top of that, there are thee data sources (I think) that we would need to ensure support localization:

  • EVE Data (eve.db) - this can technically be handled by Phobos, but there's various questions on how to compile this data (do we roll with a "multilanguage" build? That would be a huge database. Do we split these out into supplemental downloads (if you want zh, you download the zh database separately)). Etc. And then we need to support things like searching on this (I really don't know how our search handles with chinese characters)
  • Application text. We can use the built in localization functions for this, that's pretty "easy" if not time consuming.
  • User data. I'm pretty sure this would work as it should already support unicode, but again need to figure out how well supported it is.

As for the example repo you provided, unfortunately it looks like the maintainer basically just copied our repo without forking it, did the changes, and did one huge commit. I can't see what specifically was changed without digging into the source, which makes it difficult to see what happened. A quick look shows that they modified the source text directly (eg: self.notebookBrowsers.AddPage(self.marketBrowser, "市场", image=marketImg, closeable=False)) so this tells me that this is a hardcoded Chinese version. Might be a good starting point to base an official localization off of tho

and lastly, there is an abandoned PR that attempted this a while ago #1581 but they rolled their own localization for the application. If pyfa were to adopt localization, it would be best to use the standard i18n package that python already ships with, and I think that's where things fell down with that PR

blitzmann avatar May 11 '20 17:05 blitzmann

@Quadrifoglio-Sha

Let's address two specific problems you mention:

  1. give examples of fit name and search pattern, and how the search does not work for you
  2. give scenario for "enemy type in DPS part", it sounds confusing.

As for pyfa localization - it would need massive changes and I am not the dude who would be willing to do them. However:

  1. If someone wants to do that for current version of pyfa, I will gladly accept pull request
  2. Eventually we will rewrite pyfa using new tools (I just started rewriting calculation engine using rust, front-end will be rewritten using either Qt or some web stuff). If I find someone who explains how to properly support localization and/or is willing to do that on his own for the new version of pyfa, I will gladly accept such help as well

DarkFenX avatar May 12 '20 09:05 DarkFenX

@DarkFenX o/ howdy! That sound awesome on the Rust front - I'll message you on Slack this weekend to catch up (I got super lazy after we uninstalled Slack from work computers)

As for this issue, my curiosity it piqued enough to start looking into this somewhat seriously. It would be an interesting exercise to get involved with to break the hiatus I've been on and a decent learning opportunity since I've never really bothered with localization on anything that I've built. This is something we would want to do moving forward with any sort of future projects as well, so dipping in and learning a bit about this stuff might prove fruitful down the road.

I think a tiered approach would work out well - I'll start by focusing on the GUI only. Get those strings carried over to .po / .mo files. After that, a call our to the community to help translate the texts. While the translations are being done, we'll have to figure out the best way to do the database. From what I can see, we actually generate the database from base JSON files now instead of shipping the binary (assuming that work was done so that we have proper source control around that and don't have to deal with keeping large files in the repo). So it may be easy enough to include the various translations in those language files and just generate the DB when the user switches languages.

Planning on setting this as a command line option for now. Once this matures a bit we can look into some niceties such as saving last used, "first time" start up prompt, etc.

blitzmann avatar May 14 '20 03:05 blitzmann

@blitzmann yeah hi. Please hop onto slack and share what kind of IM you are using.

As for localization - i disagree that DB should be regenerated when language is switched. Phobos provides multi-language support for a long while. We can just multi-language data, store all those variants in the DB and provide name getter, which is then used by UI. I believe I can do it myself in very little time. This is easy part, though.

DarkFenX avatar May 14 '20 10:05 DarkFenX

First preview release with localization support:

https://github.com/pyfa-org/Pyfa/releases/tag/v2.24.0dev1%2Bi18n

blitzmann avatar Jul 20 '20 02:07 blitzmann

The game supports using English to search for items even when you are using another user interface language. I'm using Chinese interface language, and keywords in English. And as some names are hard to type (like ship names), I would prefer to search using their English name. Would this be supported in the future?

p.s.1 as far as I know, tools like evemarketer had also implemented this feature. p.s.2 I understand there's a eve data option for switching this, but is it possible to support multi language search at the same time?

undefined-moe avatar Jul 18 '23 08:07 undefined-moe