Repository navigation
Change locale code function to use Scratch.vm.getLocale() (as well as a few other things) - #9
Merged
Merged
Conversation
Owner
|
!format |
Owner
|
wait dangocat doesnt work here i dont think |
Owner
|
i'll just merge it and fix it on my end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on my findings,
Scratch.vm.getLocale()can be used instead ofReduxStore.getState().locales.locale. I wrote a simple custom extension to demonstrate:In TurboWarp Desktop,
Scratch.vm.getLocale()andReduxStore.getState().locales.localereturn the same thing whilenavigator.languages[0]returns the language of my system (set to Malay):The packager environment caused
Scratch.vm.getLocale()to return the same value asnavigator.languages[0](at least, I assume); this isn't an issue, since the old implementation returnednavigator.languages[0]if ReduxStore was not available. Since this is in the packager, the ReduxStore locale code check fails and returns nothing:As for the other changes, I used a guard clause to clean both
_filterArrayandgetLanguageArrayup by juust a tiny bit.I could naively remove the fallback for
navigator.languages[0]ingetLanguageCode, but I won't; it's always good to have a fallback.