language( )


Gets a code representing the site's language.

The retrieved language code corresponds to the main site language as found in the General Info section of your site's Dashboard.

Note: If you have a multilingual site, and it is being viewed in a language that is not the main site language, the language property still returns the main site language. To work with the languages of a multilingual site, use the Multilingual API.

Method Declaration
Copy
function language(): Promise<string>;
Request
This method does not take any parameters
Returns
Return Type:Promise<string>
Get the site's language
JavaScript
import { createClient } from "@wix/sdk"; import { site } from "@wix/site"; import { site as wixSite } from "@wix/site-site"; const wixClient = createClient({ host: site.host(), modules: { wixSite }, }); const language = await wixClient.wixSite.language(); // "en"
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?