Search.../

getLocale( )

Gets site locale information.

Description

The getLocale() function returns a Promise that resolves to the site's locale information.

The retrieved locale information is the information that has been entered in the General Info section of your site's Dashboard.

Syntax

function getLocale(): GeneralInfoLocale

getLocale Parameters

This function does not take any parameters.

Returns

Fulfilled - An object containing the site locale information. Rejected - Error message.

Return Type:

Promise<GeneralInfoLocale>
NAME
TYPE
DESCRIPTION
country
string

Site country.

languageCode
string

Site language code.

Was this helpful?

Get site locale information

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import wixSiteBackend from 'wix-site-backend';
3
4export const getLocale = webMethod(Permissions.Anyone, () => {
5 return wixSiteBackend.generalInfo.getLocale();
6});
7
8/*
9 * {
10 * "country": "US",
11 * "languageCode": "en"
12 * }
13 */