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

the localization for PELD #76

Open 1MLightyears opened 3 years ago

1MLightyears commented 3 years ago

Sorry! My new job has been quite busy ๐Ÿ˜ข : This pr is about a solution for localization of PELD, now PELD can be customed to display different languages in its GUI (if all things go well) The solution is simple, and i placed the discription in lang/INSTRUCTIONS.md. This pr includes many changes because most of the files need to import the new localization.py. Some other format changes are made auto by yapf with pylint.

ArtificialQualia commented 3 years ago

First: Thanks for the PR! It's a lot of work to go through this code that has architecture as more of an afterthought. I'm still going through the code changes here, but just some general thoughts/questions so far:

I think some of your path checking stuff in your localization.py file may break due to how PELD gets packaged. I think sys._MEIPASS will have to be used for path checking, but we will know for sure once we make a test build for this new code.

I'm torn on if \ns should be moved outside of translation dicts. On one hand, it would be less confusing to translators to have them out of the dicts, on the other hand different languages may have different spacing requirements. I'm leaning towards leaving them as you have them now.

I commented on a couple areas where I think multiple smaller translation strings should be merged into one larger translation string. This will help prevent mis-translations due to loss of critical context. There are probably other areas too, I haven't finished looking. Some areas certainly make sense to split up as they either contain whole thoughts/sentences or have reusable sections.

I'm not sure I can see an easy way for a user to change PELD's language looking at your code. I was envisioning something in the settings window, or perhaps auto-detection based on the OS language, but I don't see that in your PR. Nor do I see a language file for Chinese. It appears to me the PELD would just use whatever default language file is there.
Were you imagining having multiple builds/releases of PELD? One for each language supported? While that is possible, I think I'd like to have the same number of releases we have now and allow the use to switch between languages as they'd like (again, ideally defaulting to the OS language).

1MLightyears commented 3 years ago

Thank you for your review!

1MLightyears commented 3 years ago

Hi finally met my ddl of my work yesterday and get some time for PELD ๐Ÿ˜ž I'm not abandoning this! I changed as many \n as I found out of tr() and update the lang.jsonc. I also re-translated a zh-CN version of lang.jsonc and included it in the commit. The sys.__MEIPASS problem is also processed in localization.py, now it's covering both debug occasions (like python3 peld.py) and release occasions (like packaged by PyInstaller). I did a few test and it looks good, PELD seems to be localized pretty acceptable. If you really need a GUI approach of modifing language when running (like add a page in settings) please feel free to let me know. Sorry again (:ะทใ€โˆ )

ArtificialQualia commented 3 years ago

Thanks for the update! I'll give it a full look soon.

ArtificialQualia commented 3 years ago

The changes look good!

The only thing left I really want out of this is to have a single version of PELD for both Chinese and English users. As mentioned, ideally this would choose a default that makes sense based off the operating system language, and could be changed in the settings window to override that default.

If you don't want to do that, that's no problem, I can add the finishing touches on here. Just let me know what you'd like to do.

1MLightyears commented 2 years ago

Thank you for the comments! I'll be having more free time in the following few weeks & I'll try to find an approach for placing language settings in Setting window.:smile: