שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Document getIntlayer, getIntlayerAsync, getDictionary and getDictionaryAsync"v9.4.023.8.2026
- "Add comparePaths utility"v9.0.023.6.2026
- "Unified documentation for all exports"v8.0.021.1.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתאם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודהעתקת ה-Markdown של המסמך ללוח
intlayer Package
The intlayer package is the core library of the Intlayer ecosystem. It provides the essential functions, types, and utilities for managing multilingual content in JavaScript and TypeScript applications.
Installation
העתקת הקוד ללוח
Exports
Configuration
Import:
העתקת הקוד ללוח
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Variable | Type | Description | Related Doc |
|---|---|---|---|
configuration | IntlayerConfig | The Intlayer configuration object. | getConfiguration |
getConfiguration | () => IntlayerConfig | Returns the Intlayer configuration object. (Deprecated: Use configuration instead) | getConfiguration |
locales | Locales[] | The list of all supported locales. | - |
requiredLocales | Locales[] | The list of all required locales. | - |
defaultLocale | Locales | The default locale. | - |
Types
Import:
העתקת הקוד ללוח
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Type | Description |
|---|---|
Dictionary | The dictionary type used to define the structure of a dictionary. |
DeclarationContent | (Deprecated) Use Dictionary<T> instead. |
IntlayerConfig | The type defining the Intlayer configuration. |
ContentNode | A node in the dictionary content. |
Locale | The type representing a locale. |
LocalesValues | The possible values for a locale. |
StrictModeLocaleMap | A map of locales with strict type checking. |
Content Functions
Import:
העתקת הקוד ללוח
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Function | Type | Description | Related Doc |
|---|---|---|---|
t / getTranslation | Function | Picks content based on the current locale. | translation |
enu / getEnumeration | Function | Picks content based on a quantity. | enumeration |
cond / getCondition | Function | Picks content based on a boolean condition. | condition |
gender | Function | Picks content based on a gender. | gender |
insert | Function | Inserts values into a content string. | insertion |
nest / getNesting | Function | Nests another dictionary. | nesting |
md | Function | Processes markdown content. | markdown |
html | Function | Processes HTML content. | html |
file | Function | Handles file content. | file |
getDictionary | Function | Processes objects that look like dictionaries (key, content). It processes t() translations, enumerations, etc. | getDictionary |
getDictionaryAsync | Function | Loads a single locale chunk of a dictionary from a per-locale loader map, then processes it. | getDictionaryAsync |
getIntlayer | Function | Based on getDictionary, but injects an optimized version of the dictionary from the generated declaration. | getIntlayer |
getIntlayerAsync | Function | Async counterpart of getIntlayer, loading only the requested locale. For metadata, loaders, server functions. | getIntlayerAsync |
Localization Utilities
Import:
העתקת הקוד ללוח
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Function | Type | Description | Related Doc |
|---|---|---|---|
getLocale | Function | Detects the locale from a string or path. | getLocale |
getLocaleLang | Function | Gets the language part of a locale. | getLocaleLang |
getLocaleName | Function | Gets the display name of a locale. | getLocaleName |
getLocalizedPath | Function | Resolves a canonical path to localized. | getLocalizedPath |
getCanonicalPath | Function | Resolves a localized path to canonical. | getCanonicalPath |
getLocalizedUrl | Function | Generates a localized URL. | getLocalizedUrl |
getMultilingualUrls | Function | Generates URLs for all supported locales. | getMultilingualUrls |
getPathWithoutLocale | Function | Removes the locale prefix from a path. | getPathWithoutLocale |
getPrefix | Function | Gets the locale prefix from a path. | getPrefix |
comparePaths | Function | Compares two paths ignoring the locale. | comparePaths |
normalizePath | Function | Normalizes a path to a locale-agnostic one. | comparePaths |
getHTMLTextDir | Function | Gets the text direction (LTR/RTL). | getHTMLTextDir |
validatePrefix | Function | Validates a locale prefix. | validatePrefix |
Browser Utilities
Import:
העתקת הקוד ללוח
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Function | Type | Description |
|---|---|---|
getBrowserLocale | Function | Detects the browser's preferred locale. |
getCookie | Function | Retrieves a cookie value. |
getLocaleFromStorage | Function | Retrieves the locale from storage. |
setLocaleInStorage | Function | Saves the locale to storage. |
Formatters
Import:
העתקת הקוד ללוח
פתיחת הטבלה בחלון כדי לראות את כל תוכן הנתונים בבירור
| Function | Description |
|---|---|
number | Formats a number. |
currency | Formats a currency value. |
percentage | Formats a percentage. |
compact | Formats a number in compact form. |
date | Formats a date. |
relativeTime | Formats relative time. |
units | Formats a value with units. |
Intl | The standard Intl object. |
