Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support automatic language switching in Microsoft Edge and other UI Automation text implementations #6853

Merged
merged 3 commits into from Mar 14, 2017

Conversation

michaelDCurran
Copy link
Member

@michaelDCurran michaelDCurran commented Feb 8, 2017

A part from exposing language information from UI Automation text formatting, this PR also supports mappings of all Windows primary language locale identifiers to locale names. This has been manually calculated from locale.windows_locale. Oddly windows_locale does not contain them directly.

Both UI Automation and ITextDocument may expose these primary language locale identifiers if country specific information is not available.

For example, the html

<p lang="de">

exposes LCID 0x7 (German) as opposed to

<p lang="de-DE">

which exposes 0x407 (German, Germany).

This also should provide a more complete fix for #6611 as that was caused due to values such as 0x09 (English) missing from the mapping.

Fixes #6852

…ale identifiers to locale names. This has been manually calculated from locale.windows_locale. Oddly windows_locale does not contain them directly.

Both UI Automation and ITextDocument may expose these primary language locale identifiers if country specific information is not available.
For example, the html <p lang="de"> exposes LCID 0x7 (German) as opposed to <p lang="de-DE"> which exposes 0x407 (German, Germany).
@@ -135,6 +136,13 @@ def _getFormatFieldAtRange(self,range,formatConfig,ignoreMixedValues=False):
annotationTypes=getUIATextAttributeValueFromRange(range,UIAHandler.UIA_AnnotationTypesAttributeId,ignoreMixedValues=ignoreMixedValues)
if annotationTypes==UIAHandler.AnnotationType_SpellingError:
formatField["invalid-spelling"]=True
val=getUIATextAttributeValueFromRange(range,UIAHandler.UIA_CultureAttributeId,ignoreMixedValues=ignoreMixedValues)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think val could have a better name. Perhaps cultureCodeVal.

michaelDCurran added a commit that referenced this pull request Feb 10, 2017
@michaelDCurran michaelDCurran merged commit db11e37 into master Mar 14, 2017
@nvaccessAuto nvaccessAuto added this to the 2017.2 milestone Mar 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support automatic language switching in Microsoft Edge
3 participants