Class: LocaleDetection

LocaleDetection()

<brut-locale-detection>

Send the locale and timezone from the browser to a configured endpoint on the server. This allows the server to have access to a reasonable guess as to the website visitor's locale/timezone.

Note that this will not contact the server if both locale-from-server and timezone-from-server are set. Further note that this will only contact the server once per page load, unless url is changed.

Constructor

new LocaleDetection()

Properties:
Name Type Description
locale-from-server String

omit this if the server doesn't know the visitor's locale. If both this and timezone-from-server are set, the server will not be contacted.

timezone-from-server String

omit this if the server doesn't know the visitor's timezone. If both this and locale-from-server are set, the server will not be contacted.

url URL

the url to send information to on the server.

timeout-before-ping-ms number

MS to wait until this element contacts the server. A value of 0 will contact the server immediately. The default is 1,000, meaning this element will wait 1 second before contacting the server.

Source:
Examples

When no information about the visitor is known

<brut-locale-detection url="__brut/locale-detection"></brut-locale-detection>

When all information about the visitor is known

<brut-locale-detection
  url="__brut/locale-detection"
  locale-from-server="en-US"
  timezone-from-server="America/New_York">
</brut-locale-detection>