Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language selector to login screen, use enums in localization code #125

Merged
merged 8 commits into from
Nov 8, 2024

Conversation

StenAL
Copy link

@StenAL StenAL commented Nov 7, 2024

This PR contains fixes and changes to the localization system with the ultimate end goal of having the user select their preferred language on the login screen instead of having to use CLI flags.

When users with different languages join a lobby together, they get grouped by language in the players list (see the bottom screenshots).

Before After
image image
image image

These were previously swapped. A locale is a language + region, e.g.
en_us or fi_fi whereas a language is just the first part of a locale.
This is what it actually represents.
This complements the Locale enum and helps avoid string parsing each
time the language is desired.
These will be used in both the server and client so they need to be
moved to a place where they're available in both.
These are still converted to strings by consumers, but it's a first step
towards using these strong types everywhere.
The repository has no .loc localization files so there's no point in
keeping the code to load them around as it just makes TextManager harder
to comprehend.

Also, this enables simplifying the code path that is actually taken in
loadLanguageFiles.
Now users can play the game in a different language without using CLI
flags.
Copy link
Owner

Choose a reason for hiding this comment

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

The file needs to be cleaned up and deobfuscated at some point… I will open up and issue to keep track of that.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah it's one of the more difficult files to understand so I haven't touched it much.

Copy link
Owner

@PhilippvK PhilippvK left a comment

Choose a reason for hiding this comment

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

This looks good, thank you!

I am happy to contribute German translation at some point 😄

@PhilippvK PhilippvK merged commit 93d3977 into PhilippvK:master Nov 8, 2024
2 checks passed
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