Ticket #2687 (new feature)

Opened 3 years ago

Last modified 3 years ago

read default language from document

Reported by: arno Owned by:
Priority: minor Milestone: 2.13 Release
Component: general Version: 2.9
Keywords: Cc:
State:

Description

Hi, when language is not set explicitely with OpenLayers.Lang.setCode, default language is read from navigator ui language. But maybe it would be better to first check for a lang attribute in <html> tag. So, default openlayers language would reflect the webpage language instead of the navigator language.

Attachments

2687.0.patch Download (1.7 KB) - added by fredj 3 years ago.
Lang.setCode() without argument: take html lang attribute then browser lang setting
2687.1.patch Download (2.3 KB) - added by fredj 3 years ago.
update docstring

Change History

Changed 3 years ago by arno

for example, something like following code could be used ?

setCode: function(code) {

var lang; if(!code) {

+ code = document.documentElement.getAttribute("lang"); + } + if(!code) {

code = (OpenLayers.Util.getBrowserName() == "msie") ?

navigator.userLanguage : navigator.language;

}

Changed 3 years ago by fredj

Lang.setCode() without argument: take html lang attribute then browser lang setting

Changed 3 years ago by fredj

update docstring

Note: See TracTickets for help on using tickets.