מחבר:
הפנו את עוזר ה-AI המועדף עליכם למסמך הזהChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Init doc"v9.5.519.9.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתעריכת המסמך הזה
אם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודנוצר:2026-09-19עדכון אחרון:2026-09-19
העתקה
העתקת ה-Markdown של המסמך ללוח
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
src/pages/index.astro
העתקת קוד
העתקת הקוד ללוח
You can also pass inline dictionaries defined with t():
src/components/Footer.astro
העתקת קוד
העתקת הקוד ללוח
Parameters
ts
העתקת קוד
העתקת הקוד ללוח
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.
