Skip to content

selectLocales$(options?: TLocaleOptions): Observable<TLocaleOptions>

The selectLocales$ method allows you to get an observable with the locales currently used in a shop

Input parameters

options (optional)

TLocaleOptions represents an object of locale settings on which the returned results will be based. If not specified, current shop locales will be returned.

Returned value

A returned value has a type of TLocaleOptions.

Example

In this example we make a StorefrontSettingsApi call to get an observable with the locales currently used in a shop.

    useStorefront(async (storefront) => {
        const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');

        const locales$ = storefrontSettingsApi.selectLocales$();

        locales$.subscribe((locales) => {
            console.log('code of the current currency used in the shop', locales.currency);
        });
    });

Storefront Settings API methods reference

Objects reference