selectAllLocales$(): Observable¶
The selectAllLocales$ method allows you to get an observable that emits all available locales in the shop
Returned value¶
A returned value has a type of Observable that emits an array of TLocale objects representing all available locales in the shop.
Example¶
In this example we make a StorefrontSettingsApi call to get an observable with all available locales in the shop.
useStorefront(async (storefront) => {
const storefrontSettingsApi = storefront.getApiSync('StorefrontSettingsApi');
const allLocales$ = storefrontSettingsApi.selectAllLocales$();
allLocales$.subscribe((allLocales) => {
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$
- getAllLocales
- getCurrencies
- selectCurrencies$
- getCountries
- selectCountries$
- getCountryById
- selectCountryById$
- getCountryByCode
- selectCountryByCode$