Fix [sc-25008] - correct and improve legacy language warnings #14401
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.
The legacy language warning was misfiring when a user's language didn't match the APP_LOCALE from .env.
Additionally, we weren't properly warning when the legacy-language came from Settings or from the user themselves. Both of which should be impossible but still probably not a bad idea to warn on it, anyways
Testing
First, I stashed my changes and prove that the bug exists the way I said -
I will set my user to have a language of 'en-US' and set the
APP_LOCALE
to 'pt-PT'. I got this message:Then, I reapplied my change and reloaded the dashboard. That message then went away.
Next, I changed the
APP_LOCALE
to be 'en', and my user's locale to be 'es'. I got this:(Note, we didn't have an es->es-MX fallback in-place, so this behavior is expected)
Finally, I blanked out my user's locale setting, and reloaded the dashboard. The messages I got were:
(Note, we never had a 'pt' language so it didn't select pt-PT as the fallback)