How I can switch spellchecker language in WebView2?

Post Reply
Radotm
Posts: 1
Joined: Tue Nov 01, 2022 2:07 pm

How I can switch spellchecker language in WebView2?

Post by Radotm »

I'm developing html wysiwyg editor based on WebView2 control.
WebView2 is doing a spell check, but it seems like only language that spellchecker is supported is English. I want to change the language runtime. Using the recommended solution CoreWebView2EnvironmentOptions.Language only changes the language in the context menu.

Is it possible to control the spell checking language in WebView2 solution?
User avatar
salvadordf
Posts: 4089
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How I can switch spellchecker language in WebView2?

Post by salvadordf »

Hi,

The GlobalWebView2Loader.Language property sets the CoreWebView2EnvironmentOptions.Language value and according to the documentation it should change the language of the user interface and also the "Accept-Language" header :
It applies to browser UIs such as context menu and dialogs. It also applies to the accept-languages HTTP header that WebView sends to websites. It is in the format of language[-country] where language is the 2-letter code from ISO 639 and country is the 2-letter code from ISO 3166.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2environmentoptions.language?view=webview2-dotnet-1.0.1370.28

...but there's a known issue in WebView2 and it uses the default OS language :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/1859
https://github.com/MicrosoftEdge/WebView2Feedback/issues/1162

Apparently there's a workaround to change the "Accept-Language" HTTP header in TWVBrowser.OnWebResourceRequested but I don't think that will change the spellchecker language.
Post Reply