getLocales(options?: TLocaleOptions): TLocaleOptions¶
The getLocales
method allows you to retrieve 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 retrieve the locales currently used in a shop.
useStorefront(async (storefront) => {
const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');
const locales = storefrontSettingsApi.getLocales();
console.log('code of the current currency used in the shop', locales.currency);
});
Storefront Settings API methods reference¶
- getSkinSettings
- getPageSettings
- selectSkinSettings$
- selectPageSettings$
- selectFrontstoreApiUrl$
- selectLocales$
- getCountries
- selectCountries$
- getCountryById
- selectCountryById$
- getCountryByCode
- selectCountryByCode$