מחבר:
הפנו את עוזר ה-AI המועדף עליכם למסמך הזהChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Unified documentation for all exports"v8.0.021.1.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתעריכת המסמך הזה
אם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודנוצר:2026-01-21עדכון אחרון:2026-09-27
העתקה
העתקת ה-Markdown של המסמך ללוח
useLocale Hook Documentation
The useLocale hook allows you to manage the current locale in your Solid application. It provides access to the current locale (as an accessor), the default locale, available locales, and a function to update the locale.
Usage
tsx
העתקת קוד
העתקת הקוד ללוח
Description
The hook returns an object with the following properties:
- locale: A Solid accessor (
() => string) returning the current locale. - defaultLocale: The default locale defined in your
intlayer.config.ts. - availableLocales: An array of all locales supported by your application.
- setLocale: A function to update the application's locale. It also handles persistence (cookies/local storage) if enabled.
Parameters
- props (optional):
- onLocaleChange: A callback function called whenever the locale changes.
- isCookieEnabled: Whether to persist the locale in a cookie.
