Search.../

locale

Deprecated. The locale property is being deprecated. Use the browserLocale property instead.

Description

Gets the locale of the current environment.

Migration Instructions

If this property is already in your code, it will continue to work. To stay compatible with future changes, migrate to wixWindow.browserLocale.

To migrate to the new property:

  1. Look for any code that uses wixWindow.locale and replace it with wixWindow.browserLocale.

  2. Test your changes to make sure your code behaves as expected.

A locale, also known as an IETF language tag, is an abbreviated code that defines the user's language, country, and other aspects of the user interface 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, Italy

Type:

stringRead Only

Was this helpful?

Get an environment's locale

Copy Code
1// NOTE: This example uses the new wixWindow.browserLocale
2// property, which replaces wixWindow.locale.
3// See line 13 for the deprecated example.
4
5import wixWindow from 'wix-window';
6
7// ...
8
9let browserLocale = wixWindow.browserLocale; // "en-US"
10
11
12
13// NOTE: This example uses the deprecated
14// wixWindow.locale property.
15
16import wixWindow from 'wix-window';
17
18// ...
19
20let locale = wixWindow.locale; // "en-US"