Skip to main content
Returns the language code for the current language that the chat widget uses, for example, en for English or fr for French. If a region is specified, it returns the language and region codes, for example, pt-BR for Brazilian Portuguese.

Syntax

const locale = instance.getLocale();

Parameters

None

Returns

string
The current locale code, for example, en, fr, pt-BR.

Examples

The following example gets the current locale:
// Get current locale
const currentLocale = instance.getLocale();
console.log('Current locale:', currentLocale);

// Use locale to customize behavior
if (instance.getLocale() === 'ja') {
    console.log('Japanese locale is active');
}

Do you need practical examples?

Learn how to apply the features available for embedded chat into your implementation with guidance and examples.