-
Notifications
You must be signed in to change notification settings - Fork 97
add dialog keys for the critical error handler #991
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
base: dev
Are you sure you want to change the base?
add dialog keys for the critical error handler #991
Conversation
DashingCat
left a comment
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.
I agree that adding dialog keys is better than hard-coding text in UIs, and from my testing this PR works as intended, both in English and other languages (which fallback to English text).
However the changes in CriticalErrorHandler.cs could be simpler.
The function PopulateDialog is not needed as Dialog.Get already uses the English language if the dialog keys are not translated in other languages (relevant code below).
Everest/Celeste.Mod.mm/Patches/Dialog.cs
Lines 184 to 199 in 33ad712
| public static string Get(string name, Language language = null) { | |
| if (string.IsNullOrEmpty(name)) | |
| return ""; | |
| name = name.DialogKeyify(); | |
| language ??= Dialog.Language; | |
| if (language.Dialog.TryGetValue(name, out string result)) | |
| return result; | |
| if (language != FallbackLanguage && FallbackLanguage.Dialog.TryGetValue(name, out result)) | |
| return result; | |
| WarnMissingDialogId(name, language); | |
| return "[" + name + "]"; | |
| } |
I will approve this PR once the changes in CriticalErrorHandler.cs are simplified.
0abb711 to
23975ab
Compare
SnipUndercover
left a comment
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, I just want to test before approving.
| playerShouldTeabag = CoreModule.Settings.CrashHandlerAlwaysTeabag || (!(Settings.Instance?.DisableFlashes ?? true) && new Random().Next(0, 10) == 0); | ||
| isColonThree = CoreModule.Settings.CrashHandlerAlwaysColonThree || new Random().Next(0, 10) == 0; |
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.
| playerShouldTeabag = CoreModule.Settings.CrashHandlerAlwaysTeabag || (!(Settings.Instance?.DisableFlashes ?? true) && new Random().Next(0, 10) == 0); | |
| isColonThree = CoreModule.Settings.CrashHandlerAlwaysColonThree || new Random().Next(0, 10) == 0; | |
| Random rng = new(); | |
| playerShouldTeabag = CoreModule.Settings.CrashHandlerAlwaysTeabag || (!(Settings.Instance?.DisableFlashes ?? true) && rng.Next(0, 10) == 0); | |
| isColonThree = CoreModule.Settings.CrashHandlerAlwaysColonThree || rng.Next(0, 10) == 0; |
| } | ||
|
|
||
| [Command("criticalerrorhandler", "open the critical error handler screen")] | ||
| private static void CmdCriticalErrorHandler() { |
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.
Do we want to allow changing the exception message?
| Logger.Info("crit-error-handler", $"Created critical error handler for exception {errorType}: {errorMessage}"); | ||
| } | ||
|
|
||
| private void PopulateDialog() { |
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.
Probably add a comment that we're doing this to not have to call Dialog.Get multiple times in case something's wrong with the dialog.
|
...i just realized i tested this but completely forgot to approve. awesome Though, one more review is necessary anyways so... |
|
Looks good, I'd like Snip's comments to get resolved before approving though. |

:3