New to KendoReact? Start a free 30-day trial
Using the
Applying the
Services
The Internationalization package exposes IntlService service for default and customized internationalization of locales and LocalizationService for providing messages based on the current language.
Using the IntlService in Components
To use the service in your own components:
- Use the
IntlProvidercomponent in your parent component. - If you require locale data that is different from the default
en-USlocale data, load the data you need in your parent component. - Access the
IntlService:- In Functional Components—Through the
useInternationalizationhook. - In Class Components —Register your child component for internationalization by using the
registerForIntlfunction and consume it through theprovideIntlServicefunction.
- In Functional Components—Through the
Change Theme
Theme
Loading ...
Applying the LocalizationService in Components
The toLanguageString method of the LocalizationService accepts a key and a default value. To use the LocalizationService in your own components in conjunction with the LocalizationProvider:
- Use the
LocalizationProvidercomponent in your parent component. - Set the
languageproperty. - Access the
LocalizationService:- In Functional Components—Through the
useLocalizationhook. - In Class Components —Register your child component for internationalization by using the
registerForLocalizationfunction and consume it through theprovideLocalizationServicefunction.
- In Functional Components—Through the
Change Theme
Theme
Loading ...
Customizing the Default Service
To override the default behavior of the internationalization service:
- Inherit
IntlServiceand override the necessary methods. - Inherit the
IntlProvidercomponent and override itsgetIntlServicemethod. - Use the customized
IntlProvidercomponent.
Change Theme
Theme
Loading ...