ReactHelpers
useDefaultLocale()
API Reference for the useDefaultLocale hook
Overview
The useDefaultLocale
hook retrieves the application's default locale from the <GTProvider>
context.
This locale represents the fallback language for your app and is typically used when a user's preferred locale is unavailable.
Ensure your app is wrapped in a <GTProvider>
.
See <GTProvider>
for configuration.
If no default locale is specified it defaults to 'en-US'
.
Reference
Returns
A string representing the application's default locale, e.g., 'en-US'
.
Examples
Basic Usage
Retrieve the application's default locale and display it in your component.
Notes
- The
useDefaultLocale()
hook relies on the<GTProvider>
to access the context. Ensure your app is wrapped with a provider at the root level. - Learn more about locale strings here.
Next Steps
- See
useLocale
to retrieve the user's locale.