@intlayer/docs 8.9.4-canary.0 → 8.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/generated/docs.entry.cjs +20 -0
  2. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  3. package/dist/esm/generated/docs.entry.mjs +20 -0
  4. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  5. package/dist/types/generated/docs.entry.d.ts +1 -0
  6. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  7. package/docs/ar/mcp_server.md +30 -17
  8. package/docs/ar/plugins/sync-po.md +354 -0
  9. package/docs/de/mcp_server.md +29 -16
  10. package/docs/de/plugins/sync-po.md +354 -0
  11. package/docs/en/mcp_server.md +31 -18
  12. package/docs/en/plugins/sync-po.md +354 -0
  13. package/docs/en-GB/mcp_server.md +31 -18
  14. package/docs/en-GB/plugins/sync-po.md +354 -0
  15. package/docs/es/mcp_server.md +30 -17
  16. package/docs/es/plugins/sync-po.md +354 -0
  17. package/docs/fr/mcp_server.md +30 -17
  18. package/docs/fr/plugins/sync-po.md +354 -0
  19. package/docs/hi/mcp_server.md +31 -18
  20. package/docs/hi/plugins/sync-po.md +354 -0
  21. package/docs/id/mcp_server.md +30 -17
  22. package/docs/id/plugins/sync-po.md +354 -0
  23. package/docs/it/mcp_server.md +30 -17
  24. package/docs/it/plugins/sync-po.md +354 -0
  25. package/docs/ja/mcp_server.md +29 -16
  26. package/docs/ja/plugins/sync-po.md +354 -0
  27. package/docs/ko/mcp_server.md +31 -18
  28. package/docs/ko/plugins/sync-po.md +354 -0
  29. package/docs/pl/mcp_server.md +30 -17
  30. package/docs/pl/plugins/sync-po.md +354 -0
  31. package/docs/pt/mcp_server.md +30 -17
  32. package/docs/pt/plugins/sync-po.md +354 -0
  33. package/docs/ru/mcp_server.md +30 -17
  34. package/docs/ru/plugins/sync-po.md +354 -0
  35. package/docs/tr/mcp_server.md +31 -18
  36. package/docs/tr/plugins/sync-po.md +354 -0
  37. package/docs/uk/mcp_server.md +29 -16
  38. package/docs/uk/plugins/sync-po.md +354 -0
  39. package/docs/vi/mcp_server.md +30 -17
  40. package/docs/vi/plugins/sync-po.md +354 -0
  41. package/docs/zh/mcp_server.md +31 -18
  42. package/docs/zh/plugins/sync-po.md +354 -0
  43. package/package.json +6 -6
  44. package/src/generated/docs.entry.ts +20 -0
@@ -0,0 +1,354 @@
1
+ ---
2
+ createdAt: 2026-05-10
3
+ updatedAt: 2026-05-10
4
+ title: Sync PO plugin
5
+ description: Synchronize Intlayer dictionaries with Gettext PO files. Keep your existing i18n while using Intlayer to manage, translate, and test your messages.
6
+ keywords:
7
+ - Intlayer
8
+ - Sync PO
9
+ - Gettext
10
+ - i18n
11
+ - translations
12
+ slugs:
13
+ - doc
14
+ - plugin
15
+ - sync-po
16
+ youtubeVideo: https://www.youtube.com/watch?v=MpGMxniDHNg
17
+ history:
18
+ - version: 8.9.4
19
+ date: 2026-05-10
20
+ changes: "Initial Sync PO plugin documentation"
21
+ ---
22
+
23
+ # Sync PO (i18n bridges) - Sync PO with ICU / i18next support
24
+
25
+ Use Intlayer as an add‑on to your existing i18n stack. This plugin keeps your Gettext PO messages in sync with Intlayer dictionaries so you can:
26
+
27
+ - Keep your existing PO-based translation workflow.
28
+ - Manage and translate your messages with Intlayer (CLI, CI, providers, CMS), without refactoring your app.
29
+ - Ship tutorials and SEO content targeting each ecosystem, while suggesting Intlayer as the PO management layer.
30
+
31
+ Notes and current scope:
32
+
33
+ - Externalization to the CMS works for translations and classic text.
34
+ - No support yet for insertions, plurals/ICU, or advanced runtime features of other libraries within the PO entries themselves.
35
+ - The visual editor is not supported yet for third‑party i18n outputs.
36
+
37
+ ### When to use this plugin
38
+
39
+ - You already use Gettext PO files for your translations.
40
+ - You want AI‑assisted fill, test in CI, and content ops without changing your rendering runtime.
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pnpm add -D @intlayer/sync-po-plugin
46
+ # or
47
+ npm i -D @intlayer/sync-po-plugin
48
+ ```
49
+
50
+ ## Plugins
51
+
52
+ This package provides two plugins:
53
+
54
+ - `loadPO`: Load PO files into Intlayer dictionaries.
55
+ - This plugin is used to load PO files from a source and will be loaded into Intlayer dictionaries. It can scan all the codebase and search for specific PO files.
56
+ This plugin can be used
57
+ - if you use an i18n library that imposes a specific location for your PO files to be loaded, but you want to place your content declaration where you want in your code base.
58
+ - It can also be used if you want to fetch your messages from a remote source (ex: a CMS, an API, etc.) and store your messages in PO files.
59
+
60
+ > Under the hood, this plugin will scan all the codebase and search for specific PO files and load them into Intlayer dictionaries.
61
+ > Note that this plugin will not write the output and translations back to the PO files.
62
+
63
+ - `syncPO`: Synchronize PO files with Intlayer dictionaries.
64
+ - This plugin is used to synchronize PO files with Intlayer dictionaries. It can scan the given location and load the PO that match the pattern for specific PO files. This plugin is useful if you want to get the benefits of Intlayer while using another i18n library.
65
+
66
+ ## Using both plugins
67
+
68
+ ```ts fileName="intlayer.config.ts"
69
+ import { Locales, type IntlayerConfig } from "intlayer";
70
+ import { loadPO, syncPO } from "@intlayer/sync-po-plugin";
71
+
72
+ const config: IntlayerConfig = {
73
+ internationalization: {
74
+ locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
75
+ defaultLocale: Locales.ENGLISH,
76
+ },
77
+
78
+ // Keep your current PO files in sync with Intlayer dictionaries
79
+ plugins: [
80
+ /**
81
+ * Will load all the PO files in the src that match the pattern {key}.i18n.po
82
+ */
83
+ loadPO({
84
+ source: ({ key }) => `./src/**/${key}.i18n.po`,
85
+ locale: Locales.ENGLISH,
86
+ priority: 1, // Ensures these PO files take precedence over files at `./locales/en/${key}.po`
87
+ }),
88
+ /**
89
+ * Will load, and write the output and translations back to the PO files in the locales directory
90
+ */
91
+ syncPO({
92
+ source: ({ key, locale }) => `./locales/${locale}/${key}.po`,
93
+ priority: 0,
94
+ }),
95
+ ],
96
+ };
97
+
98
+ export default config;
99
+ ```
100
+
101
+ ## `syncPO` plugin
102
+
103
+ ### Quick start
104
+
105
+ Add the plugin to your `intlayer.config.ts` and point it at your existing PO structure.
106
+
107
+ ```ts fileName="intlayer.config.ts"
108
+ import { Locales, type IntlayerConfig } from "intlayer";
109
+ import { syncPO } from "@intlayer/sync-po-plugin";
110
+
111
+ const config: IntlayerConfig = {
112
+ internationalization: {
113
+ locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
114
+ defaultLocale: Locales.ENGLISH,
115
+ },
116
+
117
+ // Keep your current PO files in sync with Intlayer dictionaries
118
+ plugins: [
119
+ syncPO({
120
+ // Per-locale, per-namespace layout
121
+ source: ({ key, locale }) => `./locales/${locale}/${key}.po`,
122
+ }),
123
+ ],
124
+ };
125
+
126
+ export default config;
127
+ ```
128
+
129
+ Alternative: single file per locale:
130
+
131
+ ```ts fileName="intlayer.config.ts"
132
+ import { Locales, type IntlayerConfig } from "intlayer";
133
+ import { syncPO } from "@intlayer/sync-po-plugin";
134
+
135
+ const config: IntlayerConfig = {
136
+ internationalization: {
137
+ locales: [Locales.ENGLISH, Locales.FRENCH],
138
+ defaultLocale: Locales.ENGLISH,
139
+ },
140
+ plugins: [
141
+ syncPO({
142
+ source: ({ locale }) => `./locales/${locale}.po`,
143
+ }),
144
+ ],
145
+ };
146
+
147
+ export default config;
148
+ ```
149
+
150
+ #### How it works
151
+
152
+ - Read: the plugin discovers PO files from your `source` builder and loads them as Intlayer dictionaries.
153
+ - Write: after builds and fills, it writes localized PO back to the same paths (with proper Gettext headers).
154
+ - Auto‑fill: the plugin declares an `autoFill` path for each dictionary. Running `intlayer fill` updates only missing translations in your PO files by default.
155
+
156
+ API:
157
+
158
+ ```ts
159
+ syncPO({
160
+ source: ({ key, locale }) => string, // required
161
+ location?: string, // optional label, default: "sync-po::path/to/source"
162
+ priority?: number, // optional priority for conflict resolution, default: 0
163
+ format?: 'icu' | 'i18next' | 'vue-i18n', // optional, only needed when your msgstr values use a specific interpolation syntax
164
+ });
165
+ ```
166
+
167
+ #### `format` ('icu' | 'i18next' | 'vue-i18n')
168
+
169
+ PO files are always Gettext Portable Object files — that is fixed. This option only describes the **interpolation syntax** used inside the `msgstr` values, so Intlayer can convert them to its own format at parse time (via `formatDictionary`) and back when writing output.
170
+
171
+ - `undefined` _(default)_: `msgstr` values are treated as plain strings — no transformation. Use this for most PO files.
172
+ - `'icu'`: `msgstr` values use ICU message syntax (e.g. `{count, plural, one {# item} other {# items}}`).
173
+ - `'i18next'`: `msgstr` values use i18next interpolation syntax (e.g. `{{variable}}`).
174
+ - `'vue-i18n'`: `msgstr` values use Vue I18n syntax.
175
+
176
+ > Transformation is applied by `@intlayer/chokidar`'s `formatDictionary` on load, and reversed with `formatDictionaryOutput` on write. For complex rules like ICU plurals, round-trip fidelity is not guaranteed.
177
+
178
+ **Example — PO files contain i18next-style interpolation:**
179
+
180
+ ```ts
181
+ syncPO({
182
+ source: ({ key, locale }) => `./locales/${locale}/${key}.po`,
183
+ format: "i18next",
184
+ }),
185
+ ```
186
+
187
+ ### Multiple PO sources and priority
188
+
189
+ You can add multiple `syncPO` plugins to synchronize different PO sources. This is useful when you have multiple translation sources or different PO structures in your project.
190
+
191
+ #### Priority system
192
+
193
+ When multiple plugins target the same dictionary key, the `priority` parameter determines which plugin takes precedence:
194
+
195
+ - Higher priority numbers win over lower ones
196
+ - Default priority of `.content` files is `0`
197
+ - Default priority of plugins is `0`
198
+ - Plugins with the same priority are processed in the order they appear in the configuration
199
+
200
+ ```ts fileName="intlayer.config.ts"
201
+ import { Locales, type IntlayerConfig } from "intlayer";
202
+ import { syncPO } from "@intlayer/sync-po-plugin";
203
+
204
+ const config: IntlayerConfig = {
205
+ internationalization: {
206
+ locales: [Locales.ENGLISH, Locales.FRENCH],
207
+ defaultLocale: Locales.ENGLISH,
208
+ },
209
+
210
+ plugins: [
211
+ // Primary PO source (highest priority)
212
+ syncPO({
213
+ source: ({ key, locale }) => `./locales/${locale}/${key}.po`,
214
+ location: "main-translations",
215
+ priority: 10,
216
+ }),
217
+
218
+ // Fallback PO source (lower priority)
219
+ syncPO({
220
+ source: ({ locale }) => `./fallback-locales/${locale}.po`,
221
+ location: "fallback-translations",
222
+ priority: 5,
223
+ }),
224
+
225
+ // Legacy PO source (lowest priority)
226
+ syncPO({
227
+ source: ({ locale }) => `/my/other/app/legacy/${locale}/messages.po`,
228
+ location: "legacy-translations",
229
+ priority: 1,
230
+ }),
231
+ ],
232
+ };
233
+
234
+ export default config;
235
+ ```
236
+
237
+ ## Load PO plugin
238
+
239
+ ### Quick start
240
+
241
+ Add the plugin to your `intlayer.config.ts` to ingest existing PO files as Intlayer dictionaries. This plugin is read‑only (no writes to disk):
242
+
243
+ ```ts fileName="intlayer.config.ts"
244
+ import { Locales, type IntlayerConfig } from "intlayer";
245
+ import { loadPO } from "@intlayer/sync-po-plugin";
246
+
247
+ const config: IntlayerConfig = {
248
+ internationalization: {
249
+ locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
250
+ defaultLocale: Locales.ENGLISH,
251
+ },
252
+
253
+ plugins: [
254
+ // Ingest PO messages located anywhere in your source tree
255
+ loadPO({
256
+ source: ({ key }) => `./src/**/${key}.i18n.po`,
257
+ // Load a single locale per plugin instance (defaults to the config defaultLocale)
258
+ locale: Locales.ENGLISH,
259
+ priority: 0,
260
+ }),
261
+ ],
262
+ };
263
+
264
+ export default config;
265
+ ```
266
+
267
+ Alternative: per‑locale layout, still read‑only (only the selected locale is loaded):
268
+
269
+ ```ts fileName="intlayer.config.ts"
270
+ import { Locales, type IntlayerConfig } from "intlayer";
271
+ import { loadPO } from "@intlayer/sync-po-plugin";
272
+
273
+ const config: IntlayerConfig = {
274
+ internationalization: {
275
+ locales: [Locales.ENGLISH, Locales.FRENCH],
276
+ defaultLocale: Locales.ENGLISH,
277
+ },
278
+ plugins: [
279
+ loadPO({
280
+ // Only files for Locales.FRENCH will be loaded from this pattern
281
+ source: ({ key, locale }) => `./locales/${locale}/${key}.po`,
282
+ locale: Locales.FRENCH,
283
+ }),
284
+ ],
285
+ };
286
+
287
+ export default config;
288
+ ```
289
+
290
+ ### How it works
291
+
292
+ - Discover: builds a glob from your `source` builder and collects matching PO files.
293
+ - Ingest: loads each PO file as an Intlayer dictionary with the provided `locale`.
294
+ - Read‑only: does not write or format output files; use `syncPO` if you need round‑trip sync.
295
+ - Auto‑fill ready: defines a `fill` path so `intlayer content fill` can populate missing keys.
296
+
297
+ ### API
298
+
299
+ ```ts
300
+ loadPO({
301
+ // Build paths to your PO. `locale` is optional if your structure has no locale segment
302
+ source: ({ key, locale }) => string,
303
+
304
+ // Target locale for the dictionaries loaded by this plugin instance
305
+ // Defaults to configuration.internationalization.defaultLocale
306
+ locale?: Locale,
307
+
308
+ // Optional label to identify the source
309
+ location?: string, // default: "plugin"
310
+
311
+ // Priority used for conflict resolution against other sources
312
+ priority?: number, // default: 0
313
+ });
314
+ ```
315
+
316
+ ### Behavior and conventions
317
+
318
+ - If your `source` mask includes a locale placeholder, only files for the selected `locale` are ingested.
319
+ - If there is no `{key}` segment in your mask, the dictionary key is "index".
320
+ - Keys are derived from file paths by substituting the `{key}` placeholder in your `source` builder.
321
+ - The plugin only uses discovered files and does not fabricate missing locales or keys.
322
+ - The `fill` path is inferred from your `source` and used to update missing values via CLI when you opt‑in.
323
+
324
+ ## Conflict resolution
325
+
326
+ When the same translation key exists in multiple PO sources:
327
+
328
+ 1. The plugin with the highest priority determines the final value
329
+ 2. Lower priority sources are used as fallbacks for missing keys
330
+ 3. This allows you to maintain legacy translations while gradually migrating to new structures
331
+
332
+ ## CLI
333
+
334
+ The synchronized PO files will be considered as other `.content` files. That means, all intlayer commands will be available for the synchronized PO files. Including:
335
+
336
+ - `intlayer content test` to test if there are missing translations
337
+ - `intlayer content list` to list the synchronized PO files
338
+ - `intlayer content fill` to fill the missing translations
339
+ - `intlayer content push` to push the synchronized PO files
340
+ - `intlayer content pull` to pull the synchronized PO files
341
+
342
+ See [Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/cli/index.md) for more details.
343
+
344
+ ## Limitations (current)
345
+
346
+ - No insertions or plurals/ICU support when targeting third‑party libraries.
347
+ - Visual editor is not available for non‑Intlayer runtimes yet.
348
+ - PO synchronization only; non‑PO catalog formats are not supported.
349
+
350
+ ## Why this matters
351
+
352
+ - We can recommend established i18n solutions and position Intlayer as an add‑on.
353
+ - We leverage their SEO/keywords with tutorials that end by suggesting Intlayer to manage PO.
354
+ - Expands the addressable audience from “new projects” to “any team already using i18n”.
@@ -23,7 +23,7 @@ history:
23
23
  changes: "Add set up of Claude Desktop"
24
24
  - version: 5.5.12
25
25
  date: 2025-07-10
26
- changes: "Add SSE transport and distant server"
26
+ changes: "Add Streamable HTTP transport and distant server"
27
27
  - version: 5.5.10
28
28
  date: 2025-06-29
29
29
  changes: "Initialise history"
@@ -51,12 +51,12 @@ By enabling the Intlayer MCP Server in your IDE, you unlock:
51
51
 
52
52
  > View the full list of commands and options in the [Intlayer CLI documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/cli/index.md).
53
53
 
54
- ## Local server (stdio) vs Remote server (SSE)
54
+ ## Local server (stdio) vs Remote server (Streamable HTTP)
55
55
 
56
56
  The MCP server can be used in two ways:
57
57
 
58
58
  - Local server (stdio)
59
- - Remote server (SSE)
59
+ - Remote server (Streamable HTTP)
60
60
 
61
61
  ### Local server (stdio) (recommended)
62
62
 
@@ -64,9 +64,9 @@ Intlayer provides an NPM package that can be installed locally on your machine.
64
64
 
65
65
  This server is the recommended way to use the MCP server, as it integrates all the features of the MCP server, including the CLI tools.
66
66
 
67
- ### Remote server (SSE)
67
+ ### Remote server (Streamable HTTP)
68
68
 
69
- The MCP server can also be used remotely, using the SSE transport method. This server is hosted by Intlayer and is available at https://mcp.intlayer.org. This server can be accessed publicly, without any authentication, and is free to use.
69
+ The MCP server can also be used remotely, using the Streamable HTTP transport method. This server is hosted by Intlayer and is available at https://mcp.intlayer.org. This server can be accessed publicly, without any authentication, and is free to use.
70
70
 
71
71
  Note that the remote server does not integrate CLI tools, AI autocompletion, etc. The remote server is only for interaction with the documentation to assist your AI assistant with the Intlayer ecosystem.
72
72
 
@@ -97,7 +97,7 @@ bun x intlayer init mcp
97
97
  This command will:
98
98
 
99
99
  1. Ask you which platform you are using (Cursor, VS Code, Claude Desktop, etc.).
100
- 2. Ask you which transport method you want to use (Local server (stdio) or Remote server (SSE)).
100
+ 2. Ask you which transport method you want to use (Local server (stdio) or Remote server (Streamable HTTP)).
101
101
  3. Automatically update your configuration file (e.g., `.cursor/mcp.json`, `.vscode/mcp.json`, or the global Claude Desktop config).
102
102
 
103
103
  ---
@@ -107,7 +107,7 @@ This command will:
107
107
  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).
108
108
  2. Type `Intlayer: Setup AI Agent Skills`
109
109
  3. Pick the platform you use (e.g. `VS Code`, `Cursor`, `Windsurf`, `OpenCode`, `Claude Code`, `GitHub Copilot Workspace`, etc.).
110
- 4. Pick the MCP to install (stdio, SSE)
110
+ 4. Pick the MCP to install (stdio, Streamable HTTP)
111
111
  5. Press Enter.
112
112
 
113
113
  ---
@@ -131,16 +131,16 @@ In your project root, add the following `.cursor/mcp.json` configuration file:
131
131
  }
132
132
  ```
133
133
 
134
- ### Remote server (SSE)
134
+ ### Remote server (Streamable HTTP)
135
135
 
136
- For connecting to a remote Intlayer MCP server using Server-Sent Events (SSE), you can configure your MCP client to connect to the hosted service.
136
+ For connecting to a remote Intlayer MCP server using Server-Sent Events (Streamable HTTP), you can configure your MCP client to connect to the hosted service.
137
137
 
138
138
  ```json fileName=".cursor/mcp.json"
139
139
  {
140
140
  "mcpServers": {
141
- "intlayer": {
142
- "url": "https://mcp.intlayer.org",
143
- "transport": "sse"
141
+ "intlayer-sse": {
142
+ "command": "npx",
143
+ "args": ["-y", "mcp-remote@latest", "https://mcp.intlayer.org"]
144
144
  }
145
145
  }
146
146
  }
@@ -172,16 +172,16 @@ Create a `.vscode/mcp.json` file in your project root:
172
172
  }
173
173
  ```
174
174
 
175
- ### Remote server (SSE)
175
+ ### Remote server (Streamable HTTP)
176
176
 
177
- For connecting to a remote Intlayer MCP server using Server-Sent Events (SSE), you can configure your MCP client to connect to the hosted service.
177
+ For connecting to a remote Intlayer MCP server using Server-Sent Events (Streamable HTTP), you can configure your MCP client to connect to the hosted service.
178
178
 
179
179
  ```json fileName=".vscode/mcp.json"
180
180
  {
181
181
  "servers": {
182
- "intlayer": {
183
- "url": "https://mcp.intlayer.org",
184
- "type": "sse"
182
+ "intlayer-sse": {
183
+ "command": "npx",
184
+ "args": ["-y", "mcp-remote@latest", "https://mcp.intlayer.org"]
185
185
  }
186
186
  }
187
187
  }
@@ -191,7 +191,7 @@ For connecting to a remote Intlayer MCP server using Server-Sent Events (SSE), y
191
191
 
192
192
  ## Set Up in ChatGPT
193
193
 
194
- ### Remote server (SSE)
194
+ ### Remote server (Streamable HTTP)
195
195
 
196
196
  Follow the [official documentation](https://platform.openai.com/docs/mcp#test-and-connect-your-mcp-server) to configure the MCP server in ChatGPT.
197
197
 
@@ -232,6 +232,19 @@ Path of the config file:
232
232
  }
233
233
  ```
234
234
 
235
+ ### Remote server (Streamable HTTP)
236
+
237
+ ```json fileName="claude_desktop_config.json"
238
+ {
239
+ "mcpServers": {
240
+ "intlayer-sse": {
241
+ "command": "npx",
242
+ "args": ["-y", "mcp-remote@latest", "https://mcp.intlayer.org"]
243
+ }
244
+ }
245
+ }
246
+ ```
247
+
235
248
  ---
236
249
 
237
250
  ## Using the MCP Server via CLI