Locale API
This is the POS UI Extension API for localization.
Receiving locale updates
Anchor link to section titled "Receiving locale updates"
LocaleApiContent
Anchor link to section titled "LocaleApiContent"Name | Type | Description |
---|---|---|
subscribable | RemoteSubscribable |
IETF-formatted locale at time of page load and a callback to subsribe to value changes. Current supports only one subscription. You can utilize makeStatefulSubscribable on a RemoteSubscribable to implement multiple subscriptions. Using makeStatefulSubscribable or the corresponding hooks counts as a subscription. |
RemoteSubscribable
Anchor link to section titled "RemoteSubscribable"Name | Type | Description |
---|---|---|
initial | string |
Merchant’s current locale. |
Name | Description |
---|---|
useLocaleSubscription() | A hook utilizing useState and the useStatefulSubscribableLocale function to create a component state. This hook returns the latest Locale state which re-renders on change. |
useStatefulSubscribableLocale() | A hook utilizing the makeStatefulSubscribable function to allow multiple Locale subscriptions. This hook returns StatefulRemoteSubscribable object with a Locale in it. |
destroyStatefulSubscribableLocale() | A function destroying the subscriptions useStatefulSubscribableLocale has. |