getAllLocales(): TLocale[]¶
The getAllLocales method allows you to retrieve all available locales in the shop
Returned value¶
A returned value has a type of array of TLocale objects representing all available locales in the shop.
Example¶
In this example we make a StorefrontSettingsApi call to retrieve all available locales in the shop.
useStorefront(async (storefront) => {
const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');
const allLocales = storefrontSettingsApi.getAllLocales();
allLocales.forEach((locale) => {
console.log('Locale:', locale.name, 'Code:', locale.locale);
});
});
Storefront Settings API methods reference¶
- getSkinSettings
- getPageSettings
- selectSkinSettings$
- selectPageSettings$
- selectFrontstoreApiUrl$
- getLocales
- selectLocales$
- getLocalesAndCurrenciesSettings
- selectLocalesAndCurrenciesSettings$
- selectAllLocales$
- getCurrencies
- selectCurrencies$
- getCountries
- selectCountries$
- getCountryById
- selectCountryById$
- getCountryByCode
- selectCountryByCode$