Creation:2026-01-21Last update:2026-05-06
Reference this doc to your favorite AI assistantChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Update Solid useIntlayer API usage to direct property access"v8.9.004/05/2026
- "Unified documentation for all exports"v8.0.021/01/2026
The content of this page was translated using an AI.
See the last version of the original content in EnglishEdit this doc
If 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
Copy doc Markdown to clipboard
useIntlayer Hook Documentation
The useIntlayer hook allows you to retrieve localised content from a dictionary using its key. In Solid, this hook returns reactive content that updates whenever the locale changes.
Usage
tsx
Copy code
Copy the code to the clipboard
import { useIntlayer } from "solid-intlayer";const MyComponent = () => { const content = useIntlayer("my-dictionary-key"); return ( <div> <h1>{content.title}</h1> <p>{content.description}</p> </div> );};Description
The hook performs the following tasks:
- Locale Detection: It uses the current locale from the
IntlayerProvidercontext. - Dictionary Injection: It automatically injects the content of the dictionary corresponding to the provided key, using the optimised declarations generated by the Intlayer compiler.
- Reactivity: It returns a Solid accessor (
Accessor<T>) that automatically re-evaluates when the global locale state changes. - Translation Processing: It resolves the content based on the detected locale, processing any
t(),enu(), etc. definitions found within the dictionary.
Parameters
- key: The unique key of the dictionary (as defined in your content declaration files).
- locale (optional): Override the current locale.
Returns
An accessor function (() => Content) that returns the localised content.