More robust detection of language code with no description#15031
Merged
Conversation
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.
Link to issue number:
Closes #15017 (work-around)
Summary of the issue:
On a specific system (see #15017), Windows cannot get the language name from LCID. This cause an uncaught error preventing the OCR settings panel to be fully created (and the previous panel to be cleared).
Description of user facing changes
Displaying the OCR settings will not fail anymore on some systems where it is not possible to derive the language name from LCID.
Description of development approach
When listing OCR languages, we use
languageHandler.getLanguageDescriptionto determine the name given the language code. However this function may returnNonein case it cannot find a language name.This return value had not been taken into account when listing the OCR languages.
Thus this PR allows to add the language code instead of is name in the OCR list as a fallback if the name cannot be found.
A
debugWarningis logged in the functionlanguageHandler.getLanguageDescriptionif the language cannot be found; note that this function is used in some add-ons.In the settings panel instead, I log an error so that the situations with unknown languages can be captured more easily.
Testing strategy:
Known issues with pull request:
This PR fixes the GUI issue but do not convert the language code to a valid language name.
The issue described in #15017 seems to occur only on a specific system running a Windows version that is not supported anymore (Windows 10 1809). Moreover the user will not have access to this system in the future. Thus I prefer not to modify our language normalization or conversion functions since I am not confident on how these modifications would impact other systems.
An error is logged for language codes that cannot be converted to full language names; so if other people face this issue we will have the information in the log (and in the GUI featuring language code instead of name). We may think to a fix if this impact many people on up-to-date systems.
Change log entries:
Bug fixes
Displaying the OCR settings will not fail on some systems anymore. (#15017)Code Review Checklist: