שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Extracted from the Intlayer CMS documentation into its own page"v9.0.08.7.2026
- "Add live sync documentation"v6.0.122.9.2025
- "Replace `hotReload` field by `liveSync`"v6.0.04.9.2025
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתאם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודהעתקת ה-Markdown של המסמך ללוח
Intlayer Live Sync
Live Sync lets your app reflect Intlayer CMS content changes at runtime. No rebuild or redeploy required. When enabled, updates are streamed to a Live Sync server that refreshes the dictionaries your application reads.
Table of Contents
Enabling Live Sync
Enable Live Sync by updating your Intlayer configuration:
העתקת הקוד ללוח
import type { IntlayerConfig } from "intlayer";
const config: IntlayerConfig = {
// ... other configuration settings
editor: {
/**
* Enables hot reloading of locale configurations when changes are detected.
* For example, when a dictionary is added or updated, the application updates
* the content displayed on the page.
*
* Because hot reloading requires a continuous connection to the server, it is
* only available for clients of the `enterprise` plan.
*
* Default: false
*/
liveSync: true,
},
dictionary: {
/**
* Controls how dictionaries are imported:
*
* - "fetch": Dictionaries are fetched dynamically using the Live Sync API.
* Replaces useIntlayer with useDictionaryDynamic.
*
* Note: Live mode uses the Live Sync API to fetch dictionaries. If the API call
* fails, dictionaries are imported dynamically.
* Note: Only dictionaries with remote content and "live" flags use live mode.
* Others use dynamic mode for performance.
*/
importMode: "fetch",
},
};
export default config;
Start the Live Sync server to wrap your application:
Example using standalone server:
העתקת הקוד ללוח
You can also use your application server in parallel using the --process argument.
Example using Next.js:
העתקת הקוד ללוח
Example using Vite:
העתקת הקוד ללוח
The Live Sync server wraps your application and automatically applies updated content as it arrives.
To receive change notifications from the CMS, the Live Sync server maintains an SSE connection to the backend. When content changes in the CMS, the backend forwards the update to the Live Sync server, which writes the new dictionaries. Your application will reflect the update on the next navigation or browser reload, no rebuild required.
Flow chart (CMS/Backend -> Live Sync Server -> Application Server -> Frontend):
How it works:
Development workflow (local)
- In development, all remote dictionaries are fetched when the application starts, so you can test updates quickly.
- To test Live Sync locally with Next.js, wrap your dev server:
העתקת הקוד ללוח
Enable optimization so Intlayer applies the Live import transformations during development:
העתקת הקוד ללוח
import type { IntlayerConfig } from "intlayer";
const config: IntlayerConfig = {
editor: {
applicationURL: "http://localhost:5173",
liveSyncURL: "http://localhost:4000",
liveSync: true,
},
dictionary: {
importMode: "fetch",
},
build: {
optimize: true, // default: process.env.NODE_ENV === 'production'
},
};
export default config;
This setup wraps your dev server with the Live Sync server, fetches remote dictionaries at startup, and streams updates from the CMS via SSE. Refresh the page to see changes.
Notes and constraints
- Add the live sync origin to your site security policy (CSP). Ensure the live sync URL is allowed in
connect-src(andframe-ancestorsif relevant). - Live Sync does not work with static output. For Next.js, the page must be dynamic to receive updates at runtime (e.g., use
generateStaticParams,generateMetadata,getServerSideProps, orgetStaticPropsappropriately to avoid full static-only constraints). - In the CMS, each dictionary has a
liveflag. Only dictionaries withlive=trueare fetched via the live sync API; others are imported dynamically and remain unchanged at runtime. - The
liveflag is evaluated for each dictionary at build time. If remote content wasn't flaggedlive=trueduring build, you must rebuild to enable Live Sync for that dictionary. - The live sync server must be able to write to
.intlayer. In containers, ensure write access to/.intlayer.
