-
Notifications
You must be signed in to change notification settings - Fork 85
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
Ensure a valid langauge is always used #579
Conversation
This fixes an issue where user might select a new language, then revert to older version of mod that doesn't have that language; it would try using the previously selected language, not find it, and crash. The update ensures default language will be used in any case where selected language is not available.
Unfortunately your fix doesn't change anything 😉 You can make quick test: change manually your current language code to |
Ah, I should have also checked the method below... will update PR in a few moments after doing some extra testing. |
I suggest adding new method to Translation class which will set current code to null if |
Here is stack trace, will update PR once fixed.
Also updated global config docs in wiki |
It might look a bit different on current Labs and Stable 😉 |
If not, do extra validation and correct the global config language.
In latest commit, I made following changes:
|
Also, I didn't get any errors on TM:PE STABLE (and I assume LABS will be similar). I think the issue only occurs on TM:PE 11.0-alpha7 to 11.0-alpha10. In other words, the error was specific to the new localisation system, as far as I can tell. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
@kvakvs While I'm in here editing stuff, what is the purpose of |
@aubergine10 This is legacy function, I did not create it. It is used by |
Found an event that's fired on game locale change (thanks Klyte45), and hooked in to General options tab code for when user alters langauge setting in TM:PE options, so now the validation checking only occurs when necessary.
Committed some changes that hopefully fix the outstanding issues. It now works as follows:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and works good now 👍
@kvakvs any comments before I merge this? |
The version jump from alpha4 to alpha11 is confusing, otherwise i'm ok with that |
This fixes an issue where user might select a new language, then revert to older version of mod that doesn't have that language; it would try using the previously selected language, not find it, and crash.
This PR ensures default language will be used in any case where selected language is not available.
Note, however, this will obviously only fix the issue from version 11.0-alpha11 and above. There is no way to retroactively fix it on older versions of the mod.