Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Init doc"v9.5.519/09/2026
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
useDictionary Hook Documentation
The useDictionary hook resolves an imported or inline dictionary object and returns its content for the current locale in Astro applications.
Unlike useIntlayer, which retrieves dictionaries by key from the global dictionary registry, useDictionary works directly with a dictionary object.
Usage
Copy the code to the clipboard
You can also pass inline dictionaries defined with t():
Copy the code to the clipboard
Parameters
Copy the code to the clipboard
dictionary: A dictionary object or qualified dictionary group.localeOrSelector(optional): A specific locale or selector object ({ item },{ variant }, optionally withlocale).
Description
The hook performs the following tasks:
- Locale Detection: On the server, it obtains the locale from
Astro.locals.intlayer. In the browser, it uses the client-side store locale. - Content Processing: Resolves translations (
t()), enumerations, conditions, and nested structures according to the resolved locale. - Selectors: Applies any item or variant selectors provided in the arguments.
