Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
This doc is out of date, the base version has been updated on 21 January 2026.
Go to English docVersion History
- "Initial history"v5.5.1029/06/2025
The content of this page was translated using an AI.
See the last version of the original content in EnglishIf you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
React Integration: useDictionary Hook Documentation
This section provides detailed guidance on using the useDictionary hook within React applications, enabling efficient handling of localised content without a visual editor.
Importing useDictionary in React
The useDictionary hook can be integrated into React applications by importing it based on the context:
Client Component:
Server Component:
Parameters
The hook accepts two parameters:
dictionary: A declared dictionary object containing localised content for specific keys.locale(optional): The desired locale. Defaults to the current context's locale if not specified.
Dictionary
All dictionary objects should be declared in structured content files to ensure type safety and prevent runtime errors. You can find the setup instructions here. Here's an example of content declaration:
Example Usage in React
Below is an example of how to use the useDictionary hook in a React component:
Server Integration
If you are using the useDictionary hook outside the IntlayerProvider, the locale must be explicitly provided as a parameter when rendering the component:
Notes on Attributes
Unlike integrations using visual editors, attributes such as buttonTitle.value do not apply here. Instead, directly access the localised strings as declared in your content.
Additional Tips
- Type Safety: Always use
Dictionaryto define your dictionaries to ensure type safety. - Localisation Updates: When updating content, ensure all locales are consistent to avoid missing translations.
This documentation focuses on the integration of the useDictionary hook, providing a streamlined approach to managing localised content without relying on visual editor functionalities.