Open 1MLightyears opened 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 \n
s 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).
Thank you for your review!
sys._MEIPASS
, since it failed in my python:AttributeError: module 'sys' has no attribute '_MEIPASS'
\n
, I'd like to suppose that the translator may not be so familiar about technological details, so maybe it's a better idea that all \n
is left outside the strings, ensuring the translators to see one whole sentence at a time. If you also agree with this I can review and change them again.lang.jsonc
by mistake! ๐ญ Have to translate again, sad story, will include that in the next commitHi
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 (:ะทใโ )
Thanks for the update! I'll give it a full look soon.
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.
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:
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 toimport
the newlocalization.py
. Some other format changes are made auto byyapf
withpylint
.