Gets the locale of the site visitor's browser.
A locale, also known as an IETF language tag, is an abbreviated code that defines the language, country, and other aspects of the site visitor's browser, such as number format and date format.
Some common locales include:
"en-US"
: English, United States"en-GB"
: English, British"es-ES"
: Spanish, Spain"de-DE"
: German, Germany"ja-JP"
: Japanese, Japan"fr-CH"
: French, Switzerland"it-IT"
: Italian, Italyfunction browserLocale(): Promise<string>;
import { createClient } from "@wix/sdk";
import { site } from "@wix/site";
import { window as wixWindow } from "@wix/site-window";
const wixClient = createClient({
host: site.host(),
modules: { wixWindow },
});
// ...
let browserLocale = await wixClient.wixWindow.browserLocale(); // "en-US"
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.