fix: handle java language format [DHIS2-18031] #395
Closed
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.
See https://dhis2.atlassian.net/jira/software/c/projects/DHIS2/issues/DHIS2-18031
Background
This ticket converts keyUiLocale from the Java format (e.g. pt_BR) to the ISO format (pt-BR). The app is currently crashing because the functions to generate periods within multi-calendar-dates fails when passed a locale string.
Note: We also have two UI locales that include script (
uz_UZ_Cyrl
,uz_UZ_Latn
), which in valid ISO format would be (uz-Cyrl-UZ
,uz-Latn-UZ
), but these cause problems in multi-calendar-dates even when passed in the proper ISO format, so for not I am just removing the potential script tag and converting touz-UZ
(probably need a follow up for multi-calendar-dates to handle languages with scripts)Before
After
Testing
Manual: I have tested with Portuguese (Brazilian), Arabic (Egyptian), English, Portuguese, Arabic, French, and the two varieties of Uzbek
Automated: I have added some tests for the useUserInfo hook to test that the conversion of the language code occurs as expected.