nvda
8accbfa7 - More robust detection of language code with no description (#15031)

Commit
2 years ago
More robust detection of language code with no description (#15031) 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.getLanguageDescription to determine the name given the language code. However this function may return None in 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 debugWarning is logged in the function languageHandler.getLanguageDescription if 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.
Author
Parents
Loading