Skip to content

the localization for PELD - #76

Open
1MLightyears wants to merge 2 commits into
ArtificialQualia:masterfrom
1MLightyears:master
Open

the localization for PELD#76
1MLightyears wants to merge 2 commits into
ArtificialQualia:masterfrom
1MLightyears:master

Conversation

@1MLightyears

Copy link
Copy Markdown

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.

Comment thread PyEveLiveDPS/fleetConnectionWindow.py Outdated
Comment on lines +60 to +62
text=tr(
"To use a different character for fleet mode, choose a different\n"
) + tr(" character in the 'Character...' menu on the main window"))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a single translation string?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I think i used "global replace" to wrap the strings. If you need this i can fix it.

Comment thread PyEveLiveDPS/fleetConnectionWindow.py Outdated
buttonFrame.grid(row="100", column="0", columnspan="10")
self.loginButton = tk.Button(buttonFrame, text=" Login ", command=self.login)
self.loginButton = tk.Button(buttonFrame,
text=" Login ",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my own i18n inexperience, but are commands like 'Login', 'Cancel', 'OK', universally understood?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! Looks like they are missed. Gotta check them all again! 😝

Comment thread PyEveLiveDPS/fleetConnectionWindow.py Outdated
settings.lowCPUMode = True
self.mainWindow.topLabel.configure(text="Fleet Mode (" + self.characterName + ")")
self.mainWindow.topLabel.configure(
text="Fleet Mode ({0})".format(self.characterName))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably want to translate this as well

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry again! (x_x )

def convertNumberToStr(self, number):
decimals = int(self.decimalPlaces)
formatString = '{:,.'+str(decimals)+'f}'
formatString = '{:,.' + str(decimals) + 'f}'

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: We may want to i18n displaying numbers in the future as well. Not needed for this PR I think.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Comment thread PyEveLiveDPS/settings/settingsWindow.py Outdated
Comment on lines +210 to +211
tr("Applying settings while in 'Low CPU Fleet Mode'") +
tr(" will not apply until after you end Fleet Mode.\n\n") +

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably merge these translation strings too

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger.

@ArtificialQualia

Copy link
Copy Markdown
Owner

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

Copy link
Copy Markdown
Author

Thank you for your review!

  • About the path checking, I think maybe i need to know more about sys._MEIPASS, since it failed in my python:AttributeError: module 'sys' has no attribute '_MEIPASS'
  • About \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.
  • About the interface of language part of PELD, I think PELD is a well-designed program and once am afraid that my add-ons might broke it 😞 . So I designed a localization which aims to do the smallest changes to PELD. I chose the change-file-for-different-languages solution based on an assumption that the user may not change their language often. If you think adding a new tab in Settings is a good idea, I'm also glad to implement that.
  • I deleted my Chinese version lang.jsonc by mistake! 😭 Have to translate again, sad story, will include that in the next commit

…dd sys.__MEIPASS processing stuff for consistency
@1MLightyears

Copy link
Copy Markdown
Author

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

Copy link
Copy Markdown
Owner

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

@ArtificialQualia

Copy link
Copy Markdown
Owner

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

Copy link
Copy Markdown
Author

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants