@intlayer/docs 9.2.0 → 9.3.1
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.
- package/README.md +24 -24
- package/blog/ar/index.md +1 -1
- package/blog/ar/rag_powered_documentation_assistant.md +1 -1
- package/blog/de/index.md +1 -1
- package/blog/en/index.md +1 -1
- package/blog/en-GB/index.md +1 -1
- package/blog/es/index.md +1 -1
- package/blog/fr/index.md +1 -1
- package/blog/hi/index.md +1 -1
- package/blog/id/index.md +1 -1
- package/blog/it/index.md +1 -1
- package/blog/ja/index.md +1 -1
- package/blog/ko/index.md +1 -1
- package/blog/pl/index.md +1 -1
- package/blog/pl/rag_powered_documentation_assistant.md +1 -1
- package/blog/pt/index.md +1 -1
- package/blog/ru/index.md +1 -1
- package/blog/uk/index.md +1 -1
- package/blog/vi/index.md +1 -1
- package/blog/zh/index.md +1 -1
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
- package/dist/cjs/authors2.cjs +0 -1
- package/dist/cjs/common.cjs +24 -1
- package/dist/cjs/common.cjs.map +1 -1
- package/dist/cjs/generated/blog.entry.cjs +35 -6
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +35 -6
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +35 -6
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +35 -6
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/common.mjs +24 -1
- package/dist/esm/common.mjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +35 -6
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +35 -6
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +35 -6
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +35 -6
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/generated/blog.entry.d.ts.map +1 -1
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
- package/dist/types/generated/legal.entry.d.ts.map +1 -1
- package/docs/ar/bundle_optimization.md +58 -25
- package/docs/ar/configuration.md +10 -10
- package/docs/ar/interest_of_intlayer.md +24 -22
- package/docs/ar/intlayer_with_express.md +1 -1
- package/docs/ar/intlayer_with_svelte_kit.md +1 -1
- package/docs/ar/intlayer_with_tanstack+solid.md +5 -3
- package/docs/ar/intlayer_with_tanstack.md +5 -3
- package/docs/ar/live-sync.md +4 -0
- package/docs/ar/lsp.md +114 -175
- package/docs/ar/readme.md +25 -25
- package/docs/bn/bundle_optimization.md +58 -25
- package/docs/bn/configuration.md +10 -10
- package/docs/bn/interest_of_intlayer.md +24 -22
- package/docs/cs/bundle_optimization.md +58 -25
- package/docs/cs/configuration.md +10 -10
- package/docs/cs/interest_of_intlayer.md +24 -22
- package/docs/de/bundle_optimization.md +58 -25
- package/docs/de/configuration.md +10 -10
- package/docs/de/interest_of_intlayer.md +24 -22
- package/docs/de/intlayer_with_svelte_kit.md +1 -1
- package/docs/de/intlayer_with_tanstack+solid.md +5 -3
- package/docs/de/intlayer_with_tanstack.md +5 -3
- package/docs/de/live-sync.md +4 -0
- package/docs/de/lsp.md +111 -172
- package/docs/de/readme.md +24 -24
- package/docs/en/bundle_optimization.md +51 -23
- package/docs/en/configuration.md +10 -10
- package/docs/en/interest_of_intlayer.md +24 -22
- package/docs/en/intlayer_with_svelte_kit.md +1 -1
- package/docs/en/intlayer_with_tanstack+solid.md +5 -3
- package/docs/en/intlayer_with_tanstack.md +5 -3
- package/docs/en/live-sync.md +4 -0
- package/docs/en/lsp.md +109 -170
- package/docs/en/readme.md +24 -24
- package/docs/en-GB/bundle_optimization.md +58 -25
- package/docs/en-GB/configuration.md +10 -10
- package/docs/en-GB/interest_of_intlayer.md +24 -22
- package/docs/en-GB/intlayer_with_svelte_kit.md +1 -1
- package/docs/en-GB/intlayer_with_tanstack+solid.md +5 -3
- package/docs/en-GB/intlayer_with_tanstack.md +5 -3
- package/docs/en-GB/live-sync.md +4 -0
- package/docs/en-GB/lsp.md +109 -170
- package/docs/en-GB/readme.md +24 -24
- package/docs/es/bundle_optimization.md +58 -25
- package/docs/es/configuration.md +10 -10
- package/docs/es/interest_of_intlayer.md +24 -22
- package/docs/es/intlayer_with_svelte_kit.md +1 -1
- package/docs/es/intlayer_with_tanstack+solid.md +5 -3
- package/docs/es/intlayer_with_tanstack.md +5 -3
- package/docs/es/live-sync.md +4 -0
- package/docs/es/lsp.md +114 -175
- package/docs/es/readme.md +24 -24
- package/docs/fr/bundle_optimization.md +58 -25
- package/docs/fr/configuration.md +10 -10
- package/docs/fr/interest_of_intlayer.md +24 -22
- package/docs/fr/intlayer_with_svelte_kit.md +1 -1
- package/docs/fr/intlayer_with_tanstack+solid.md +5 -3
- package/docs/fr/intlayer_with_tanstack.md +5 -3
- package/docs/fr/live-sync.md +4 -0
- package/docs/fr/lsp.md +110 -171
- package/docs/fr/readme.md +24 -24
- package/docs/hi/bundle_optimization.md +58 -25
- package/docs/hi/configuration.md +10 -10
- package/docs/hi/interest_of_intlayer.md +24 -22
- package/docs/hi/intlayer_with_express.md +1 -1
- package/docs/hi/intlayer_with_svelte_kit.md +1 -1
- package/docs/hi/intlayer_with_tanstack+solid.md +5 -3
- package/docs/hi/intlayer_with_tanstack.md +5 -3
- package/docs/hi/live-sync.md +4 -0
- package/docs/hi/lsp.md +113 -174
- package/docs/hi/readme.md +24 -24
- package/docs/id/bundle_optimization.md +58 -25
- package/docs/id/configuration.md +10 -10
- package/docs/id/interest_of_intlayer.md +24 -22
- package/docs/id/intlayer_with_svelte_kit.md +1 -1
- package/docs/id/intlayer_with_tanstack+solid.md +5 -3
- package/docs/id/intlayer_with_tanstack.md +5 -3
- package/docs/id/live-sync.md +4 -0
- package/docs/id/lsp.md +113 -174
- package/docs/id/readme.md +24 -24
- package/docs/it/bundle_optimization.md +58 -25
- package/docs/it/configuration.md +10 -10
- package/docs/it/interest_of_intlayer.md +24 -22
- package/docs/it/intlayer_with_svelte_kit.md +1 -1
- package/docs/it/intlayer_with_tanstack+solid.md +5 -3
- package/docs/it/intlayer_with_tanstack.md +5 -3
- package/docs/it/live-sync.md +4 -0
- package/docs/it/lsp.md +115 -176
- package/docs/it/readme.md +24 -24
- package/docs/ja/bundle_optimization.md +58 -25
- package/docs/ja/configuration.md +10 -10
- package/docs/ja/interest_of_intlayer.md +24 -22
- package/docs/ja/intlayer_with_tanstack+solid.md +5 -3
- package/docs/ja/intlayer_with_tanstack.md +5 -3
- package/docs/ja/live-sync.md +4 -0
- package/docs/ja/lsp.md +113 -174
- package/docs/ja/readme.md +24 -24
- package/docs/ko/bundle_optimization.md +58 -25
- package/docs/ko/configuration.md +10 -10
- package/docs/ko/interest_of_intlayer.md +24 -22
- package/docs/ko/intlayer_with_svelte_kit.md +1 -1
- package/docs/ko/intlayer_with_tanstack+solid.md +5 -3
- package/docs/ko/intlayer_with_tanstack.md +5 -3
- package/docs/ko/live-sync.md +4 -0
- package/docs/ko/lsp.md +112 -173
- package/docs/ko/readme.md +24 -24
- package/docs/nl/bundle_optimization.md +58 -25
- package/docs/nl/configuration.md +10 -10
- package/docs/nl/interest_of_intlayer.md +24 -22
- package/docs/pl/bundle_optimization.md +58 -25
- package/docs/pl/configuration.md +10 -10
- package/docs/pl/interest_of_intlayer.md +4 -2
- package/docs/pl/intlayer_with_svelte_kit.md +1 -1
- package/docs/pl/intlayer_with_tanstack+solid.md +5 -3
- package/docs/pl/intlayer_with_tanstack.md +5 -3
- package/docs/pl/live-sync.md +4 -0
- package/docs/pl/lsp.md +115 -176
- package/docs/pl/readme.md +24 -24
- package/docs/pt/bundle_optimization.md +58 -24
- package/docs/pt/configuration.md +10 -10
- package/docs/pt/interest_of_intlayer.md +24 -22
- package/docs/pt/intlayer_with_svelte_kit.md +1 -1
- package/docs/pt/intlayer_with_tanstack+solid.md +5 -3
- package/docs/pt/intlayer_with_tanstack.md +5 -3
- package/docs/pt/live-sync.md +4 -0
- package/docs/pt/lsp.md +113 -174
- package/docs/pt/readme.md +24 -24
- package/docs/ru/bundle_optimization.md +58 -25
- package/docs/ru/configuration.md +10 -10
- package/docs/ru/interest_of_intlayer.md +24 -22
- package/docs/ru/intlayer_with_nextjs_14.md +1 -1
- package/docs/ru/intlayer_with_nextjs_15.md +1 -1
- package/docs/ru/intlayer_with_svelte_kit.md +1 -1
- package/docs/ru/intlayer_with_tanstack+solid.md +5 -3
- package/docs/ru/intlayer_with_tanstack.md +5 -3
- package/docs/ru/live-sync.md +4 -0
- package/docs/ru/lsp.md +112 -173
- package/docs/ru/readme.md +24 -24
- package/docs/tr/bundle_optimization.md +58 -25
- package/docs/tr/configuration.md +10 -10
- package/docs/tr/interest_of_intlayer.md +24 -22
- package/docs/tr/intlayer_with_svelte_kit.md +1 -1
- package/docs/tr/intlayer_with_tanstack+solid.md +5 -3
- package/docs/tr/intlayer_with_tanstack.md +5 -3
- package/docs/tr/live-sync.md +4 -0
- package/docs/tr/lsp.md +113 -174
- package/docs/tr/readme.md +24 -24
- package/docs/uk/bundle_optimization.md +58 -25
- package/docs/uk/configuration.md +10 -10
- package/docs/uk/interest_of_intlayer.md +4 -2
- package/docs/uk/intlayer_with_svelte_kit.md +1 -1
- package/docs/uk/intlayer_with_tanstack+solid.md +5 -3
- package/docs/uk/intlayer_with_tanstack.md +5 -3
- package/docs/uk/live-sync.md +4 -0
- package/docs/uk/lsp.md +113 -174
- package/docs/uk/per_locale_file.md +1 -1
- package/docs/uk/readme.md +24 -24
- package/docs/ur/bundle_optimization.md +58 -25
- package/docs/ur/configuration.md +10 -10
- package/docs/ur/interest_of_intlayer.md +24 -22
- package/docs/vi/bundle_optimization.md +58 -25
- package/docs/vi/configuration.md +10 -10
- package/docs/vi/interest_of_intlayer.md +24 -22
- package/docs/vi/intlayer_with_svelte_kit.md +1 -1
- package/docs/vi/intlayer_with_tanstack+solid.md +5 -3
- package/docs/vi/intlayer_with_tanstack.md +5 -3
- package/docs/vi/live-sync.md +4 -0
- package/docs/vi/lsp.md +115 -176
- package/docs/vi/readme.md +24 -24
- package/docs/zh/bundle_optimization.md +58 -25
- package/docs/zh/configuration.md +10 -10
- package/docs/zh/interest_of_intlayer.md +24 -22
- package/docs/zh/intlayer_with_svelte_kit.md +1 -1
- package/docs/zh/intlayer_with_tanstack+solid.md +5 -3
- package/docs/zh/intlayer_with_tanstack.md +5 -3
- package/docs/zh/live-sync.md +4 -0
- package/docs/zh/lsp.md +113 -174
- package/docs/zh/readme.md +21 -21
- package/docs/zh-TW/bundle_optimization.md +58 -25
- package/docs/zh-TW/interest_of_intlayer.md +24 -22
- package/package.json +7 -7
- package/src/common.ts +39 -2
- package/src/generated/blog.entry.ts +39 -7
- package/src/generated/docs.entry.ts +39 -7
- package/src/generated/frequentQuestions.entry.ts +39 -7
- package/src/generated/legal.entry.ts +39 -7
package/README.md
CHANGED
|
@@ -47,27 +47,27 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
47
47
|
|
|
48
48
|
## Keys benefits of Intlayer:
|
|
49
49
|
|
|
50
|
-
| Feature | Description
|
|
51
|
-
| --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more.
|
|
53
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content)
|
|
54
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file)
|
|
55
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler)
|
|
56
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript)
|
|
57
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs)
|
|
58
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app)
|
|
59
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code)
|
|
60
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer)
|
|
61
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs)
|
|
62
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file)
|
|
63
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms)
|
|
64
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization)
|
|
65
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs)
|
|
66
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill)
|
|
67
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md)
|
|
68
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension)
|
|
69
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) |
|
|
70
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark)
|
|
50
|
+
| Feature | Description |
|
|
51
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
52
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
|
|
53
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
|
|
54
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
|
|
55
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
|
|
56
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
|
|
57
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
58
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
|
|
59
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
|
|
60
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
|
|
61
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
62
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
|
|
63
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
|
|
64
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
|
|
65
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
66
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
|
|
67
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
|
|
68
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
|
|
69
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) <br> - [Intlayer compat adapters](https://intlayer.org/doc/compatibility) |
|
|
70
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark) |
|
|
71
71
|
|
|
72
72
|
---
|
|
73
73
|
|
|
@@ -162,7 +162,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
162
162
|
<li><a href="https://intlayer.org/doc/concept/cms" rel=''>Intlayer CMS</a></li>
|
|
163
163
|
<li><a href="https://intlayer.org/doc/concept/content" rel=''>Dictionary</a>
|
|
164
164
|
<ul>
|
|
165
|
-
<li><a href="https://intlayer.org/doc/concept/
|
|
165
|
+
<li><a href="https://intlayer.org/doc/concept/per-locale-file" rel=''>Per-Locale Content Declaration File</a></li>
|
|
166
166
|
<li><a href="https://intlayer.org/doc/concept/content/translation" rel=''>Translation</a></li>
|
|
167
167
|
<li><a href="https://intlayer.org/doc/concept/content/enumeration" rel=''>Enumeration</a></li>
|
|
168
168
|
<li><a href="https://intlayer.org/doc/concept/content/condition" rel=''>Condition</a></li>
|
|
@@ -183,7 +183,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
183
183
|
<ul>
|
|
184
184
|
<li><a href="https://intlayer.org/doc/environment/nextjs/15" rel=''>Next.js 15</a></li>
|
|
185
185
|
<li><a href="https://intlayer.org/doc/environment/nextjs/14" rel=''>Next.js 14 (App Router)</a></li>
|
|
186
|
-
<li><a href="https://intlayer.org/doc/environment/nextjs/next-with-
|
|
186
|
+
<li><a href="https://intlayer.org/doc/environment/nextjs/next-with-page-router" rel=''>Next.js Page Router</a></li>
|
|
187
187
|
<li><a href="https://intlayer.org/doc/environment/nextjs/compiler" rel=''>Next.js using Compiler</a></li>
|
|
188
188
|
</ul>
|
|
189
189
|
</li>
|
|
@@ -212,7 +212,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
212
212
|
<li><a href="https://intlayer.org/doc/environment/sveltekit" rel=''>SvelteKit</a></li>
|
|
213
213
|
<li><a href="https://intlayer.org/doc/environment/vite-and-preact" rel=''>Vite + Preact</a></li>
|
|
214
214
|
<li><a href="https://intlayer.org/doc/environment/vite-and-vue" rel=''>Vite + Vue</a></li>
|
|
215
|
-
<li><a href="https://intlayer.org/doc/environment/
|
|
215
|
+
<li><a href="https://intlayer.org/doc/environment/nuxt-and-vue" rel=''>Vite + Nuxt</a></li>
|
|
216
216
|
<li><a href="https://intlayer.org/doc/environment/vite-and-solid" rel=''>Vite + Solid</a></li>
|
|
217
217
|
<li><a href="https://intlayer.org/doc/environment/angular" rel=''>Angular</a></li>
|
|
218
218
|
<li>
|
package/blog/ar/index.md
CHANGED
|
@@ -304,7 +304,7 @@ RAG هي واحدة من أبسط وأقوى الطرق لجعل نماذج ال
|
|
|
304
304
|
- قناة تغذية راجعة
|
|
305
305
|
- أداة لاستراتيجية المنتج
|
|
306
306
|
|
|
307
|
-
👉 [جرب العرض التوضيحي هنا](https://intlayer.org/doc/
|
|
307
|
+
👉 [جرب العرض التوضيحي هنا](https://intlayer.org/ar/doc/why) 👉 [تحقق من قالب الكود على GitHub](https://github.com/aymericzip/smart_doc_RAG)
|
|
308
308
|
|
|
309
309
|
وإذا كنت تجرب RAG أيضًا، أود أن أسمع كيف تستخدمها.
|
|
310
310
|
|
package/blog/de/index.md
CHANGED
package/blog/en/index.md
CHANGED
package/blog/en-GB/index.md
CHANGED
package/blog/es/index.md
CHANGED
package/blog/fr/index.md
CHANGED
package/blog/hi/index.md
CHANGED
package/blog/id/index.md
CHANGED
package/blog/it/index.md
CHANGED
package/blog/ja/index.md
CHANGED
package/blog/ko/index.md
CHANGED
package/blog/pl/index.md
CHANGED
|
@@ -252,7 +252,7 @@ Używamy SSE do strumieniowania odpowiedzi z trasy API.
|
|
|
252
252
|
Jak wspomniano, używamy gpt-4-turbo bez trybu "myślenia". Odpowiedzi są trafne, a opóźnienia niskie.
|
|
253
253
|
Eksperymentowaliśmy z gpt-5, ale opóźnienia były zbyt duże (czasami do 15 sekund na odpowiedź). Jednak wrócimy do tego w przyszłości.
|
|
254
254
|
|
|
255
|
-
👉 [Wypróbuj demo tutaj](https://intlayer.org/doc/
|
|
255
|
+
👉 [Wypróbuj demo tutaj](https://intlayer.org/pl/doc/why) 👉 [Sprawdź szablon kodu na GitHub](https://github.com/aymericzip/smart_doc_RAG)
|
|
256
256
|
|
|
257
257
|
</Step>
|
|
258
258
|
|
package/blog/pt/index.md
CHANGED
package/blog/ru/index.md
CHANGED
package/blog/uk/index.md
CHANGED
package/blog/vi/index.md
CHANGED
package/blog/zh/index.md
CHANGED
|
@@ -19,11 +19,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
}
|
|
20
20
|
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
23
23
|
value: mod,
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
|
|
29
28
|
exports.__toESM = __toESM;
|
package/dist/cjs/authors2.cjs
CHANGED
package/dist/cjs/common.cjs
CHANGED
|
@@ -48,12 +48,35 @@ const getFileMetadata = async (files, docKey, locale = defaultLocale) => {
|
|
|
48
48
|
const file = await getFile(files, docKey, locale);
|
|
49
49
|
return formatMetadata(docKey, file, locale);
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Per-locale metadata records, keyed by the entry map they were built from.
|
|
53
|
+
*
|
|
54
|
+
* Building a record parses the frontmatter of every document of a category, and
|
|
55
|
+
* callers such as {@link getFileMetadataBySlug} need the whole record just to
|
|
56
|
+
* resolve a single slug — which a static site generator repeats for every page
|
|
57
|
+
* it renders. Documents are read once per process anyway (each entry caches its
|
|
58
|
+
* own read), so the derived metadata is equally safe to keep.
|
|
59
|
+
*/
|
|
60
|
+
const fileMetadataRecordCache = /* @__PURE__ */ new WeakMap();
|
|
61
|
+
const buildFileMetadataRecord = async (files, locale) => {
|
|
52
62
|
const filesEntries = (await Promise.allSettled(Object.entries(files).map(async ([key]) => {
|
|
53
63
|
return [key, await getFileMetadata(files, key, locale)];
|
|
54
64
|
}))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
55
65
|
return Object.fromEntries(filesEntries);
|
|
56
66
|
};
|
|
67
|
+
const getFileMetadataRecord = async (files, locale = defaultLocale) => {
|
|
68
|
+
let localeCache = fileMetadataRecordCache.get(files);
|
|
69
|
+
if (!localeCache) {
|
|
70
|
+
localeCache = /* @__PURE__ */ new Map();
|
|
71
|
+
fileMetadataRecordCache.set(files, localeCache);
|
|
72
|
+
}
|
|
73
|
+
let record = localeCache.get(locale);
|
|
74
|
+
if (!record) {
|
|
75
|
+
record = buildFileMetadataRecord(files, locale);
|
|
76
|
+
localeCache.set(locale, record);
|
|
77
|
+
}
|
|
78
|
+
return await record;
|
|
79
|
+
};
|
|
57
80
|
const getFileMetadataBySlug = async (files, slugs, locale = defaultLocale, strict = false) => {
|
|
58
81
|
const slugsArray = Array.isArray(slugs) ? slugs : [slugs];
|
|
59
82
|
const filesMetadata = await getFileMetadataRecord(files, defaultLocale);
|
package/dist/cjs/common.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.cjs","names":["Locales"],"sources":["../../src/common.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getLocalizedUrl } from '@intlayer/core/localization';\nimport { getMarkdownMetadata } from '@intlayer/core/transpiler';\nimport * as Locales from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport const defaultLocale = Locales.ENGLISH;\n\nexport const GITHUB_URL_PREFIX =\n 'https://github.com/aymericzip/intlayer/blob/main/docs';\nexport const URL_PREFIX = 'https://intlayer.org/';\n\nexport const getKeys = <T extends Record<string, any>>(obj: T): (keyof T)[] =>\n Object.keys(obj) as (keyof T)[];\n\nexport const getFiles = async <\n F extends Record<`./${string}`, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n lang: LocalesValues = defaultLocale as LocalesValues\n): Promise<Record<string, string>> => {\n const filesEntries = await Promise.all(\n Object.entries(files)\n .map(([key, value]) => [key, value[lang as LocalesValues]])\n .map(async ([key, value]) => [key, await value])\n );\n const filesResult = Object.fromEntries(filesEntries);\n return filesResult;\n};\n\nexport const getFile = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n docKey: keyof F,\n locale: LocalesValues = defaultLocale as LocalesValues\n): Promise<string> => {\n const fileRecord = files[docKey];\n\n if (!fileRecord) {\n throw new Error(`File ${docKey as string} not found`);\n }\n\n const file = await files[docKey]?.[locale];\n\n if (!file) {\n const englishFile = await files[docKey]?.[defaultLocale as LocalesValues];\n\n if (!englishFile) {\n throw new Error(`File ${docKey as string} not found`);\n }\n\n return englishFile;\n }\n\n return file;\n};\n\nexport type FileMetadata = {\n docKey: string;\n url: string;\n relativeUrl: string;\n githubUrl: string;\n title: string;\n slugs: string[];\n description: string;\n keywords: string[];\n updatedAt: string;\n createdAt: string;\n author?: string;\n youtubeVideo?: string;\n applicationTemplate?: string;\n applicationShowcase?: string;\n history?: {\n version: string;\n date: string;\n changes: string;\n }[];\n};\n\nexport const formatMetadata = (\n docKey: string,\n file: string,\n locale: LocalesValues = defaultLocale as LocalesValues\n): FileMetadata => {\n const metadata = getMarkdownMetadata(file);\n\n const slugs = (metadata.slugs ?? []).map(String);\n const keywords = (metadata.keywords ?? []).map(String);\n\n const relativeUrl = join('/', ...slugs);\n\n const slicedDocKey = docKey.slice(1);\n\n // Normalise author: accept both a plain string handle (new format)\n // and a legacy object `{ github: '...' }` — always reduce to a plain string.\n const rawAuthor = metadata.author as\n | string\n | { name?: string; github?: string }\n | undefined;\n const author: string | undefined =\n typeof rawAuthor === 'string'\n ? rawAuthor || undefined\n : rawAuthor?.github || undefined;\n\n return {\n ...metadata,\n docKey,\n slugs,\n keywords,\n author,\n githubUrl: `${GITHUB_URL_PREFIX}${slicedDocKey}`.replace(\n '/en/',\n `/${locale}/`\n ),\n relativeUrl: getLocalizedUrl(relativeUrl, locale),\n url: getLocalizedUrl(join(URL_PREFIX, relativeUrl), locale),\n } as FileMetadata;\n};\n\nexport const getFileMetadata = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n R extends FileMetadata,\n>(\n files: F,\n docKey: keyof F,\n locale: LocalesValues = defaultLocale as LocalesValues\n): Promise<R> => {\n const file = await getFile(files, docKey, locale);\n\n return formatMetadata(docKey as string, file, locale) as R;\n};\n\nexport const getFileMetadataRecord = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n locale: LocalesValues = defaultLocale as LocalesValues\n): Promise<Record<keyof F, FileMetadata>> => {\n const results = await Promise.allSettled(\n Object.entries(files).map(async ([key]) => {\n const metadata = await getFileMetadata(files, key as keyof F, locale);\n return [key, metadata] as [string, FileMetadata];\n })\n );\n const filesEntries = results\n .filter(\n (r): r is PromiseFulfilledResult<[string, FileMetadata]> =>\n r.status === 'fulfilled'\n )\n .map((r) => r.value);\n const filesResult = Object.fromEntries(filesEntries);\n return filesResult as Record<keyof F, FileMetadata>;\n};\n\nexport const getFileMetadataBySlug = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n slugs: string | string[],\n locale: LocalesValues = defaultLocale as LocalesValues,\n strict = false\n) => {\n const slugsArray = Array.isArray(slugs) ? slugs : [slugs];\n const filesMetadata = await getFileMetadataRecord(\n files,\n defaultLocale as LocalesValues\n );\n\n let fileMetadataArray: FileMetadata[] = Object.values(filesMetadata).filter(\n (fileMetadata) =>\n slugsArray.every((slug) => fileMetadata.slugs?.includes(slug))\n );\n\n if (strict) {\n fileMetadataArray = fileMetadataArray.filter(\n (fileMetadata) => fileMetadata.slugs.length === slugsArray.length\n );\n }\n\n if (locale !== defaultLocale) {\n const localizedFileMetadata = await Promise.all(\n fileMetadataArray.map(\n async (fileMetadata) =>\n await getFileMetadata(files, fileMetadata.docKey, locale)\n )\n );\n\n return localizedFileMetadata;\n }\n\n return fileMetadataArray;\n};\n\nexport const getFileBySlug = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n slugs: string | string[],\n locale: LocalesValues = defaultLocale as LocalesValues,\n strict = false\n) => {\n const slugsArray = Array.isArray(slugs) ? slugs : [slugs];\n const filesMetadata = await getFileMetadataRecord(\n files,\n defaultLocale as LocalesValues\n );\n\n let fileMetadataArray = Object.values(filesMetadata).filter((fileMetadata) =>\n slugsArray.every((slug) => fileMetadata.slugs?.includes(slug))\n );\n\n if (strict) {\n fileMetadataArray = fileMetadataArray.filter(\n (fileMetadata) => fileMetadata.slugs.length === slugsArray.length\n );\n }\n\n const fileList = await Promise.all(\n fileMetadataArray.map(async (fileMetadata) => {\n const file = await getFile(files, fileMetadata.docKey, locale);\n return file;\n })\n );\n\n return fileList;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,gBAAgBA,wBAAQ;AAErC,MAAa,oBACX;AACF,MAAa,aAAa;AAE1B,MAAa,WAA0C,QACrD,OAAO,KAAK,GAAG;AAEjB,M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a,MAAM,WAAW,WAAW,MAC7D;CAUF,OAAO,MAPgB,QAAQ,IAC7B,kBAAkB,IAAI,OAAO,iBAAiB;EAE5C,OAAO,MADY,QAAQ,OAAO,aAAa,QAAQ,MAAM;CAE/D,CAAC,CACH;AAGF"}
|
|
1
|
+
{"version":3,"file":"common.cjs","names":["Locales","getMarkdownMetadata","join","getLocalizedUrl"],"sources":["../../src/common.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getLocalizedUrl } from '@intlayer/core/localization';\nimport { getMarkdownMetadata } from '@intlayer/core/transpiler';\nimport * as Locales from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport const defaultLocale = Locales.ENGLISH;\n\nexport const GITHUB_URL_PREFIX =\n 'https://github.com/aymericzip/intlayer/blob/main/docs';\nexport const URL_PREFIX = 'https://intlayer.org/';\n\nexport const getKeys = <T extends Record<string, any>>(obj: T): (keyof T)[] =>\n Object.keys(obj) as (keyof T)[];\n\nexport const getFiles = async <\n F extends Record<`./${string}`, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n lang: LocalesValues = defaultLocale as LocalesValues\n): Promise<Record<string, string>> => {\n const filesEntries = await Promise.all(\n Object.entries(files)\n .map(([key, value]) => [key, value[lang as LocalesValues]])\n .map(async ([key, value]) => [key, await value])\n );\n const filesResult = Object.fromEntries(filesEntries);\n return filesResult;\n};\n\nexport const getFile = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n docKey: keyof F,\n locale: LocalesValues = defaultLocale as LocalesValues\n): Promise<string> => {\n const fileRecord = files[docKey];\n\n if (!fileRecord) {\n throw new Error(`File ${docKey as string} not found`);\n }\n\n const file = await files[docKey]?.[locale];\n\n if (!file) {\n const englishFile = await files[docKey]?.[defaultLocale as LocalesValues];\n\n if (!englishFile) {\n throw new Error(`File ${docKey as string} not found`);\n }\n\n return englishFile;\n }\n\n return file;\n};\n\nexport type FileMetadata = {\n docKey: string;\n url: string;\n relativeUrl: string;\n githubUrl: string;\n title: string;\n slugs: string[];\n description: string;\n keywords: string[];\n updatedAt: string;\n createdAt: string;\n author?: string;\n youtubeVideo?: string;\n applicationTemplate?: string;\n applicationShowcase?: string;\n history?: {\n version: string;\n date: string;\n changes: string;\n }[];\n};\n\nexport const formatMetadata = (\n docKey: string,\n file: string,\n locale: LocalesValues = defaultLocale as LocalesValues\n): FileMetadata => {\n const metadata = getMarkdownMetadata(file);\n\n const slugs = (metadata.slugs ?? []).map(String);\n const keywords = (metadata.keywords ?? []).map(String);\n\n const relativeUrl = join('/', ...slugs);\n\n const slicedDocKey = docKey.slice(1);\n\n // Normalise author: accept both a plain string handle (new format)\n // and a legacy object `{ github: '...' }` — always reduce to a plain string.\n const rawAuthor = metadata.author as\n | string\n | { name?: string; github?: string }\n | undefined;\n const author: string | undefined =\n typeof rawAuthor === 'string'\n ? rawAuthor || undefined\n : rawAuthor?.github || undefined;\n\n return {\n ...metadata,\n docKey,\n slugs,\n keywords,\n author,\n githubUrl: `${GITHUB_URL_PREFIX}${slicedDocKey}`.replace(\n '/en/',\n `/${locale}/`\n ),\n relativeUrl: getLocalizedUrl(relativeUrl, locale),\n url: getLocalizedUrl(join(URL_PREFIX, relativeUrl), locale),\n } as FileMetadata;\n};\n\nexport const getFileMetadata = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n R extends FileMetadata,\n>(\n files: F,\n docKey: keyof F,\n locale: LocalesValues = defaultLocale as LocalesValues\n): Promise<R> => {\n const file = await getFile(files, docKey, locale);\n\n return formatMetadata(docKey as string, file, locale) as R;\n};\n\n/**\n * Per-locale metadata records, keyed by the entry map they were built from.\n *\n * Building a record parses the frontmatter of every document of a category, and\n * callers such as {@link getFileMetadataBySlug} need the whole record just to\n * resolve a single slug — which a static site generator repeats for every page\n * it renders. Documents are read once per process anyway (each entry caches its\n * own read), so the derived metadata is equally safe to keep.\n */\nconst fileMetadataRecordCache = new WeakMap<\n Record<string, unknown>,\n Map<LocalesValues, Promise<Record<string, FileMetadata>>>\n>();\n\nconst buildFileMetadataRecord = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n locale: LocalesValues\n): Promise<Record<keyof F, FileMetadata>> => {\n const results = await Promise.allSettled(\n Object.entries(files).map(async ([key]) => {\n const metadata = await getFileMetadata(files, key as keyof F, locale);\n return [key, metadata] as [string, FileMetadata];\n })\n );\n const filesEntries = results\n .filter(\n (r): r is PromiseFulfilledResult<[string, FileMetadata]> =>\n r.status === 'fulfilled'\n )\n .map((r) => r.value);\n const filesResult = Object.fromEntries(filesEntries);\n return filesResult as Record<keyof F, FileMetadata>;\n};\n\nexport const getFileMetadataRecord = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n locale: LocalesValues = defaultLocale as LocalesValues\n): Promise<Record<keyof F, FileMetadata>> => {\n let localeCache = fileMetadataRecordCache.get(files);\n\n if (!localeCache) {\n localeCache = new Map();\n fileMetadataRecordCache.set(files, localeCache);\n }\n\n let record = localeCache.get(locale);\n\n if (!record) {\n record = buildFileMetadataRecord(files, locale);\n localeCache.set(locale, record);\n }\n\n return (await record) as Record<keyof F, FileMetadata>;\n};\n\nexport const getFileMetadataBySlug = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n slugs: string | string[],\n locale: LocalesValues = defaultLocale as LocalesValues,\n strict = false\n) => {\n const slugsArray = Array.isArray(slugs) ? slugs : [slugs];\n const filesMetadata = await getFileMetadataRecord(\n files,\n defaultLocale as LocalesValues\n );\n\n let fileMetadataArray: FileMetadata[] = Object.values(filesMetadata).filter(\n (fileMetadata) =>\n slugsArray.every((slug) => fileMetadata.slugs?.includes(slug))\n );\n\n if (strict) {\n fileMetadataArray = fileMetadataArray.filter(\n (fileMetadata) => fileMetadata.slugs.length === slugsArray.length\n );\n }\n\n if (locale !== defaultLocale) {\n const localizedFileMetadata = await Promise.all(\n fileMetadataArray.map(\n async (fileMetadata) =>\n await getFileMetadata(files, fileMetadata.docKey, locale)\n )\n );\n\n return localizedFileMetadata;\n }\n\n return fileMetadataArray;\n};\n\nexport const getFileBySlug = async <\n F extends Record<string, Record<LocalesValues, Promise<string>>>,\n>(\n files: F,\n slugs: string | string[],\n locale: LocalesValues = defaultLocale as LocalesValues,\n strict = false\n) => {\n const slugsArray = Array.isArray(slugs) ? slugs : [slugs];\n const filesMetadata = await getFileMetadataRecord(\n files,\n defaultLocale as LocalesValues\n );\n\n let fileMetadataArray = Object.values(filesMetadata).filter((fileMetadata) =>\n slugsArray.every((slug) => fileMetadata.slugs?.includes(slug))\n );\n\n if (strict) {\n fileMetadataArray = fileMetadataArray.filter(\n (fileMetadata) => fileMetadata.slugs.length === slugsArray.length\n );\n }\n\n const fileList = await Promise.all(\n fileMetadataArray.map(async (fileMetadata) => {\n const file = await getFile(files, fileMetadata.docKey, locale);\n return file;\n })\n );\n\n return fileList;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAa,gBAAgBA,wBAAQ;AAErC,MAAa,oBACX;AACF,MAAa,aAAa;AAE1B,MAAa,WAA0C,QACrD,OAAO,KAAK,GAAG;AAEjB,MAAa,WAAW,OAGtB,OACA,OAAsB,kBACc;CACpC,MAAM,eAAe,MAAM,QAAQ,IACjC,OAAO,QAAQ,KAAK,CAAC,CAClB,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,MAAM,KAAsB,CAAC,CAAC,CAC1D,IAAI,OAAO,CAAC,KAAK,WAAW,CAAC,KAAK,MAAM,KAAK,CAAC,CACnD;CAEA,OADoB,OAAO,YAAY,YACtB;AACnB;AAEA,MAAa,UAAU,OAGrB,OACA,QACA,SAAwB,kBACJ;CAGpB,IAAI,CAFe,MAAM,SAGvB,MAAM,IAAI,MAAM,QAAQ,OAAiB,WAAW;CAGtD,MAAM,OAAO,MAAM,MAAM,OAAO,GAAG;CAEnC,IAAI,CAAC,MAAM;EACT,MAAM,cAAc,MAAM,MAAM,OAAO,GAAG;EAE1C,IAAI,CAAC,aACH,MAA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Aa,QAAQ,MAAM;CAE/D,CAAC,CACH;AAGF"}
|
|
@@ -9,20 +9,49 @@ let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
|
9
9
|
const currentDir = typeof __dirname !== "undefined" ? __dirname : (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
10
10
|
let baseDir;
|
|
11
11
|
try {
|
|
12
|
-
|
|
12
|
+
const docEntryPath = (0, _intlayer_config_utils.getProjectRequire)(currentDir).resolve("@intlayer/docs");
|
|
13
|
+
baseDir = (0, _intlayer_config_utils.getPackageJsonPath)(docEntryPath).baseDir;
|
|
13
14
|
} catch {
|
|
14
15
|
try {
|
|
15
|
-
|
|
16
|
+
const docEntryPath = (0, _intlayer_config_utils.getProjectRequire)().resolve("@intlayer/docs");
|
|
17
|
+
baseDir = (0, _intlayer_config_utils.getPackageJsonPath)(docEntryPath).baseDir;
|
|
16
18
|
} catch {
|
|
17
19
|
baseDir = (0, _intlayer_config_utils.getPackageJsonPath)(currentDir).baseDir;
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Reads a document, preferring the requested locale and falling back to English.
|
|
24
|
+
*/
|
|
25
|
+
const readLocaleFile = async (relativeAfterLocale, locale) => {
|
|
21
26
|
const target1 = (0, node_path.join)(baseDir, `./blog/${locale}/${relativeAfterLocale}`);
|
|
22
|
-
if ((0, node_fs.existsSync)(target1)) return (0, node_fs_promises.readFile)(target1, "utf8");
|
|
27
|
+
if ((0, node_fs.existsSync)(target1)) return await (0, node_fs_promises.readFile)(target1, "utf8");
|
|
23
28
|
const target2 = (0, node_path.join)(baseDir, `./blog/en/${relativeAfterLocale}`);
|
|
24
|
-
if ((0, node_fs.existsSync)(target2)) return (0, node_fs_promises.readFile)(target2, "utf8");
|
|
25
|
-
|
|
29
|
+
if ((0, node_fs.existsSync)(target2)) return await (0, node_fs_promises.readFile)(target2, "utf8");
|
|
30
|
+
throw new Error(`[docs] File not found: ${relativeAfterLocale} - locale: ${locale} - path: ${target1} - path: ${target2}`);
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Builds a lazy, awaitable handle over a document.
|
|
34
|
+
*
|
|
35
|
+
* The entry map below holds one handle per document *per locale*, so reading
|
|
36
|
+
* eagerly would pull every markdown file of every locale into memory as soon as
|
|
37
|
+
* this module is imported — hundreds of megabytes, duplicated in every
|
|
38
|
+
* prerender worker, for the handful of documents a page actually renders.
|
|
39
|
+
*
|
|
40
|
+
* The returned value is a thenable rather than a promise: consumers only ever
|
|
41
|
+
* `await` it, and `await` triggers `then`, so the file is read on first use and
|
|
42
|
+
* the resulting promise is cached for subsequent reads.
|
|
43
|
+
*/
|
|
44
|
+
const readLocale = (relativeAfterLocale, locale) => {
|
|
45
|
+
let pendingRead;
|
|
46
|
+
const read = () => {
|
|
47
|
+
pendingRead ??= readLocaleFile(relativeAfterLocale, locale);
|
|
48
|
+
return pendingRead;
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
then: (onFulfilled, onRejected) => read().then(onFulfilled, onRejected),
|
|
52
|
+
catch: (onRejected) => read().catch(onRejected),
|
|
53
|
+
finally: (onFinally) => read().finally(onFinally)
|
|
54
|
+
};
|
|
26
55
|
};
|
|
27
56
|
const blogEntry = {
|
|
28
57
|
"./blog/en/compiler_vs_declarative_i18n.md": {
|