Skip to content

changeLanguage(lang: TLocaleIsoUnderscore): Promise<void>

The changeLanguage method is asynchronous and allows to change a current language in the shop.

Input parameters

lang

lang is a mandatory parameter of TLocaleIsoUnderscore type which represents a language to change to.

Returned value

A returned value has a type of Promise<void> as this method does not return anything.

Example

In this example we make a TranslationsApi call to change a language in the shop.

useStorefront(async (storefront) => {
    const translationsApi = await storefront.getApi('TranslationsApi');

    await translationsApi.changeLanguage('en_GB');
});

Translations API methods reference

Objects reference