How to set browser language?
February 10, 2017 12:00 AM
Hello,
I'm building a bilingual course that includes text entry fields. The course is English and French. In the French pages, I would like to set the html lang tag = "fr" ... I.e. undefinedspan style="color: #0000ff; font-size: small;"undefinedspan style="color: #a31515; font-size: small;"undefinedspan style="color: #ff0000; font-size: small;"undefinedspan style="color: #0000ff; font-size: small;"undefinedspan style="color: #0000ff; font-size: small;"undefinedspan style="color: #a31515; font-size: small;"undefinedspan style="color: #ff0000; font-size: small;"undefinedspan style="color: #0000ff; font-size: small;"undefinedspan style="color: #0000ff; font-size: small;"undefinedspan style="color: #a31515; font-size: small;"undefinedspan style="color: #ff0000; font-size: small;"undefinedspan style="color: #0000ff; font-size: small;"undefined!--GENERATED BY: Lectora Publisher v.12.1.4(10190) (http://www.trivantis.com) --undefined
Discussion (3)
Add an html extension header scripting with the following:
document.getElementsByTagName("html")[0].removeAttribute("lang");
document.getElementsByTagName("html")[0].setAttribute("lang", "fr");
If you prefer jQuery, add the library in a header scripting extension and then add another header scripting after it with:
$("html").removeAttr("lang");
$("html").attr("lang","fr");
undefined
Oh, I forgot to mention that if you cut and paste from the forum you will need to replace all the quotes as they do not copy over correctly.
Thank you ... that worked like a charm and set the correct attribute.
Now it depends on the user's browser add-in setting for spelling correction (at least on Windows).
undefined
Discussions have been disabled for this post