@intlayer/docs 6.1.5 → 6.1.6-canary.0

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 (53) hide show
  1. package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +404 -173
  2. package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +262 -113
  3. package/blog/en/intlayer_with_next-i18next.mdx +431 -0
  4. package/blog/en/intlayer_with_next-intl.mdx +335 -0
  5. package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +403 -140
  6. package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  7. package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +185 -71
  8. package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  9. package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  10. package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  11. package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  12. package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  13. package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +36 -28
  14. package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
  15. package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
  16. package/dist/cjs/generated/docs.entry.cjs +16 -0
  17. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  18. package/dist/esm/generated/docs.entry.mjs +16 -0
  19. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  20. package/dist/types/generated/docs.entry.d.ts +1 -0
  21. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  22. package/docs/ar/component_i18n.md +186 -0
  23. package/docs/ar/vs_code_extension.md +48 -109
  24. package/docs/de/component_i18n.md +186 -0
  25. package/docs/de/vs_code_extension.md +46 -107
  26. package/docs/en/component_i18n.md +186 -0
  27. package/docs/en/intlayer_with_nextjs_14.md +18 -1
  28. package/docs/en/intlayer_with_nextjs_15.md +18 -1
  29. package/docs/en/vs_code_extension.md +24 -114
  30. package/docs/en-GB/component_i18n.md +186 -0
  31. package/docs/en-GB/vs_code_extension.md +42 -103
  32. package/docs/es/component_i18n.md +182 -0
  33. package/docs/es/vs_code_extension.md +53 -114
  34. package/docs/fr/component_i18n.md +186 -0
  35. package/docs/fr/vs_code_extension.md +50 -111
  36. package/docs/hi/component_i18n.md +186 -0
  37. package/docs/hi/vs_code_extension.md +49 -110
  38. package/docs/it/component_i18n.md +186 -0
  39. package/docs/it/vs_code_extension.md +50 -111
  40. package/docs/ja/component_i18n.md +186 -0
  41. package/docs/ja/vs_code_extension.md +50 -111
  42. package/docs/ko/component_i18n.md +186 -0
  43. package/docs/ko/vs_code_extension.md +48 -109
  44. package/docs/pt/component_i18n.md +186 -0
  45. package/docs/pt/vs_code_extension.md +46 -107
  46. package/docs/ru/component_i18n.md +186 -0
  47. package/docs/ru/vs_code_extension.md +48 -109
  48. package/docs/tr/component_i18n.md +186 -0
  49. package/docs/tr/vs_code_extension.md +54 -115
  50. package/docs/zh/component_i18n.md +186 -0
  51. package/docs/zh/vs_code_extension.md +51 -105
  52. package/package.json +11 -11
  53. package/src/generated/docs.entry.ts +16 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-03-17
3
- updatedAt: 2025-09-22
3
+ updatedAt: 2025-09-30
4
4
  title: Offizielle VS Code Erweiterung
5
5
  description: Erfahren Sie, wie Sie die Intlayer-Erweiterung in VS Code verwenden, um Ihren Entwicklungsworkflow zu verbessern. Navigieren Sie schnell zwischen lokalisierten Inhalten und verwalten Sie Ihre Wörterbücher effizient.
6
6
  keywords:
@@ -21,94 +21,38 @@ slugs:
21
21
 
22
22
  ## Übersicht
23
23
 
24
- [**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) ist die offizielle Visual Studio Code Erweiterung für **Intlayer**, die darauf ausgelegt ist, die Entwicklererfahrung beim Arbeiten mit lokalisierten Inhalten in Ihren Projekten zu verbessern.
24
+ [**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) ist die offizielle Visual Studio Code Erweiterung für **Intlayer**, die entwickelt wurde, um die Entwicklererfahrung beim Arbeiten mit lokalisierten Inhalten in Ihren Projekten zu verbessern.
25
25
 
26
- ![Intlayer VS Code Erweiterung](https://github.com/aymericzip/intlayer/blob/main/docs/assets/vs_code_extension_demo.gif)
26
+ ![Intlayer VS Code Erweiterung](https://github.com/aymericzip/intlayer/blob/main/docs/assets/vs_code_extension_demo.gif?raw=true)
27
27
 
28
28
  Erweiterungslink: [https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension)
29
29
 
30
30
  ## Funktionen
31
31
 
32
- ### Sofortige Navigation
32
+ ![Wörterbücher füllen](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_fill_active_dictionary.gif?raw=true)
33
33
 
34
- **Unterstützung für "Gehe zu Definition"** – Verwenden Sie `⌘ + Klick` (Mac) oder `Ctrl + Klick` (Windows/Linux) auf einem `useIntlayer`-Schlüssel, um die entsprechende Inhaltsdatei sofort zu öffnen.
35
- **Nahtlose Integration** – Funktioniert mühelos mit **react-intlayer** und **next-intlayer** Projekten.
36
- **Mehrsprachige Unterstützung** – Unterstützt lokalisierte Inhalte in verschiedenen Sprachen.
37
- **VS Code Integration** – Integriert sich reibungslos in die Navigation und die Befehlspalette von VS Code.
38
-
39
- ### Befehle zur Verwaltung von Wörterbüchern
40
-
41
- Verwalten Sie Ihre Inhaltswörterbücher direkt aus VS Code:
42
-
43
- - **Wörterbücher erstellen** – Generieren Sie Inhaltsdateien basierend auf Ihrer Projektstruktur.
44
- - **Wörterbücher hochladen** – Laden Sie die neuesten Wörterbuchinhalte in Ihr Repository hoch.
45
- - **Wörterbücher herunterladen** – Synchronisieren Sie die neuesten Wörterbuchinhalte aus Ihrem Repository mit Ihrer lokalen Umgebung.
34
+ - **Sofortige Navigation** – Schneller Sprung zur richtigen Inhaltsdatei beim Klicken auf einen `useIntlayer`-Schlüssel.
46
35
  - **Wörterbücher füllen** – Füllen Sie Wörterbücher mit Inhalten aus Ihrem Projekt.
47
- - **Wörterbücher testen** – Erkennen Sie fehlende oder unvollständige Übersetzungen.
48
-
49
- ### Generator für Inhaltsdeklarationen
50
-
51
- Erstellen Sie einfach strukturierte Wörterbuchdateien in verschiedenen Formaten:
52
36
 
53
- Wenn Sie gerade an einer Komponente arbeiten, wird die Datei `.content.{ts,tsx,js,jsx,mjs,cjs,json}` für Sie generiert.
37
+ ![Befehle auflisten](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_list_commands.gif?raw=true)
54
38
 
55
- Beispiel einer Komponente:
39
+ - **Einfacher Zugriff auf Intlayer-Befehle** – Erstellen, pushen, pullen, füllen und testen Sie Inhaltswörterbücher mühelos.
56
40
 
57
- ```tsx fileName="src/components/MyComponent/index.tsx"
58
- const MyComponent = () => {
59
- const { myTranslatedContent } = useIntlayer("my-component");
41
+ ![Inhaltsdatei erstellen](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_create_content_file.gif?raw=true)
60
42
 
61
- return <span>{myTranslatedContent}</span>;
62
- };
63
- ```
64
-
65
- Generierte Datei im TypeScript-Format:
43
+ - **Generator für Inhaltsdeklarationen** – Erstellen Sie Wörterbuch-Inhaltsdateien in verschiedenen Formaten (`.ts`, `.esm`, `.cjs`, `.json`).
66
44
 
67
- ```tsx fileName="src/components/MyComponent/index.content.ts"
68
- import { t, type Dictionary } from "intlayer";
45
+ ![Wörterbücher testen](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_test_missing_dictionary.gif?raw=true)
69
46
 
70
- const componentContent = {
71
- key: "my-component",
72
- content: {
73
- myTranslatedContent: t({
74
- en: "Hello World",
75
- es: "Hola Mundo",
76
- fr: "Bonjour le monde",
77
- }),
78
- },
79
- };
47
+ - **Wörterbücher testen** – Testen Sie Wörterbücher auf fehlende Übersetzungen.
80
48
 
81
- export default componentContent;
82
- ```
49
+ ![Wörterbuch neu aufbauen](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_rebuild_dictionary.gif?raw=true)
83
50
 
84
- Verfügbare Formate:
51
+ - **Halten Sie Ihre Wörterbücher aktuell** – Halten Sie Ihre Wörterbücher mit den neuesten Inhalten aus Ihrem Projekt auf dem neuesten Stand.
85
52
 
86
- - **TypeScript (`.ts`)**
87
- - **ES Modul (`.esm`)**
88
- - **CommonJS (`.cjs`)**
89
- - **JSON (`.json`)**
90
-
91
- ### Intlayer-Tab (Aktivitätsleiste)
53
+ ![Intlayer-Tab (Aktivitätsleiste)](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_search_dictionary.gif?raw=true)
92
54
 
93
- Öffnen Sie den Intlayer-Tab, indem Sie auf das Intlayer-Symbol in der VS Code-Aktivitätsleiste klicken. Er enthält zwei Ansichten:
94
-
95
- - **Suche**: Eine Live-Suchleiste, um Wörterbücher und deren Inhalte schnell zu filtern. Das Tippen aktualisiert die Ergebnisse sofort.
96
- - **Wörterbücher**: Eine Baumansicht Ihrer Umgebungen/Projekte, Wörterbuchschlüssel und der Dateien, die Einträge beitragen. Sie können:
97
- - Auf eine Datei klicken, um sie im Editor zu öffnen.
98
- - Die Symbolleiste verwenden, um Aktionen auszuführen: Build, Pull, Push, Fill, Refresh, Test und Create Dictionary File.
99
- - Das Kontextmenü für spezifische Aktionen verwenden:
100
- - Auf einem Wörterbuch: Pull oder Push
101
- - Auf einer Datei: Wörterbuch füllen
102
- - Beim Wechseln der Editoren zeigt der Baum die passende Datei an, wenn sie zu einem Wörterbuch gehört.
103
-
104
- ## Installation
105
-
106
- Sie können **Intlayer** direkt aus dem VS Code Marketplace installieren:
107
-
108
- 1. Öffnen Sie **VS Code**.
109
- 2. Gehen Sie zum **Extensions Marketplace**.
110
- 3. Suchen Sie nach **"Intlayer"**.
111
- 4. Klicken Sie auf **Installieren**.
55
+ - **Intlayer-Tab (Aktivitätsleiste)** – Durchsuchen und durchsuchen Sie Wörterbücher über einen dedizierten Seiten-Tab mit Symbolleiste und Kontextaktionen (Build, Pull, Push, Fill, Refresh, Test, Create File).
112
56
 
113
57
  ## Verwendung
114
58
 
@@ -121,63 +65,58 @@ Sie können **Intlayer** direkt aus dem VS Code Marketplace installieren:
121
65
  const content = useIntlayer("app");
122
66
  ```
123
67
 
124
- 3. **Command-Klick** (`⌘+Klick` auf macOS) oder **Strg-Klick** (unter Windows/Linux) auf den Schlüssel (z. B. `"app"`).
68
+ 3. **Befehl-Klick** (`⌘+Klick` auf macOS) oder **Strg-Klick** (auf Windows/Linux) auf den Schlüssel (z. B. `"app"`).
125
69
  4. VS Code öffnet automatisch die entsprechende Wörterbuchdatei, z. B. `src/app.content.ts`.
126
70
 
127
- ### Verwaltung von Inhaltswörterbüchern
128
-
129
71
  ### Intlayer-Tab (Aktivitätsleiste)
130
72
 
131
- Verwenden Sie den seitlichen Tab, um Wörterbücher zu durchsuchen und zu verwalten:
73
+ Verwenden Sie den Seiten-Tab, um Wörterbücher zu durchsuchen und zu verwalten:
132
74
 
133
75
  - Öffnen Sie das Intlayer-Symbol in der Aktivitätsleiste.
134
76
  - Geben Sie in **Suche** ein, um Wörterbücher und Einträge in Echtzeit zu filtern.
135
- - Durchsuchen Sie in **Wörterbücher** Umgebungen, Wörterbücher und Dateien. Verwenden Sie die Symbolleiste für Erstellen, Abrufen, Hochladen, Füllen, Aktualisieren, Testen und Wörterbuchdatei erstellen. Rechtsklicken Sie für Kontextaktionen (Abrufen/Hochladen bei Wörterbüchern, Füllen bei Dateien). Die aktuelle Editor-Datei wird im Baum automatisch angezeigt, wenn zutreffend.
77
+ - Durchsuchen Sie in **Wörterbücher** Umgebungen, Wörterbücher und Dateien. Verwenden Sie die Symbolleiste für Erstellen, Abrufen, Senden, Füllen, Aktualisieren, Testen und Wörterbuchdatei erstellen. Rechtsklick für Kontextaktionen (Abrufen/Senden bei Wörterbüchern, Füllen bei Dateien). Die aktuelle Editor-Datei wird bei Bedarf automatisch im Baum angezeigt.
136
78
 
137
- #### Wörterbücher erstellen
79
+ ### Zugriff auf die Befehle
138
80
 
139
- Generieren Sie alle Wörterbuch-Inhaltsdateien mit:
81
+ Sie können auf die Befehle über die **Befehlspalette** zugreifen.
140
82
 
141
83
  ```sh
142
84
  Cmd + Shift + P (macOS) / Ctrl + Shift + P (Windows/Linux)
143
85
  ```
144
86
 
145
- Suchen Sie nach **Wörterbücher erstellen** und führen Sie den Befehl aus.
146
-
147
- #### Wörterbücher hochladen
148
-
149
- Laden Sie den neuesten Wörterbuchinhalt hoch:
150
-
151
- 1. Öffnen Sie die **Befehls-Palette**.
152
- 2. Suchen Sie nach **Wörterbücher hochladen**.
153
- 3. Wählen Sie die hochzuladenden Wörterbücher aus und bestätigen Sie.
154
-
155
- #### Wörterbücher abrufen
87
+ - **Wörterbücher erstellen**
88
+ - **Wörterbücher hochladen**
89
+ - **Wörterbücher herunterladen**
90
+ - **Wörterbücher füllen**
91
+ - **Wörterbücher testen**
92
+ - **Wörterbuchdatei erstellen**
156
93
 
157
- Synchronisieren Sie die neuesten Wörterbuchinhalte:
94
+ ### Laden von Umgebungsvariablen
158
95
 
159
- 1. Öffnen Sie die **Befehls-Palette**.
160
- 2. Suchen Sie nach **Wörterbücher abrufen**.
161
- 3. Wählen Sie die Wörterbücher aus, die abgerufen werden sollen.
96
+ Intlayer empfiehlt, Ihre AI-API-Schlüssel sowie die Intlayer-Client-ID und das Secret in Umgebungsvariablen zu speichern.
162
97
 
163
- #### Wörterbücher füllen
98
+ Die Erweiterung kann Umgebungsvariablen aus Ihrem Arbeitsbereich laden, um Intlayer-Befehle im richtigen Kontext auszuführen.
164
99
 
165
- Füllen Sie Wörterbücher mit Inhalten aus Ihrem Projekt:
100
+ - **Ladereihenfolge (nach Priorität)**: `.env.<env>.local` `.env.<env>` → `.env.local` → `.env`
101
+ - **Nicht destruktiv**: vorhandene `process.env`-Werte werden nicht überschrieben.
102
+ - **Geltungsbereich**: Dateien werden vom konfigurierten Basisverzeichnis aus aufgelöst (standardmäßig das Stammverzeichnis des Arbeitsbereichs).
166
103
 
167
- 1. Öffnen Sie die **Befehls-Palette**.
168
- 2. Suchen Sie nach **Wörterbücher füllen**.
169
- 3. Führen Sie den Befehl aus, um die Wörterbücher zu befüllen.
104
+ #### Auswahl der aktiven Umgebung
170
105
 
171
- #### Wörterbücher testen
106
+ - **Befehls-Palette**: Öffnen Sie die Palette und führen Sie `Intlayer: Select Environment` aus, wählen Sie dann die Umgebung aus (z. B. `development`, `staging`, `production`). Die Erweiterung versucht, die erste verfügbare Datei in der oben genannten Prioritätsliste zu laden und zeigt eine Benachrichtigung wie „Env geladen von .env.<env>.local“ an.
107
+ - **Einstellungen**: Gehen Sie zu `Einstellungen → Erweiterungen → Intlayer` und setzen Sie:
108
+ - **Umgebung**: der Umgebungsname, der zur Auflösung von `.env.<env>*` Dateien verwendet wird.
109
+ - (Optional) **Env-Datei**: ein expliziter Pfad zu einer `.env`-Datei. Wenn angegeben, hat dieser Vorrang vor der ermittelten Liste.
172
110
 
173
- Validieren Sie Wörterbücher und finden Sie fehlende Übersetzungen:
111
+ #### Monorepos und benutzerdefinierte Verzeichnisse
174
112
 
175
- 1. Öffnen Sie die **Befehls-Palette**.
176
- 2. Suchen Sie nach **Wörterbücher testen**.
177
- 3. Überprüfen Sie die gemeldeten Probleme und beheben Sie diese bei Bedarf.
113
+ Wenn sich Ihre `.env`-Dateien außerhalb des Arbeitsbereichs-Stammverzeichnisses befinden, legen Sie das **Basisverzeichnis** unter `Einstellungen → Erweiterungen → Intlayer` fest. Der Loader sucht dann nach `.env`-Dateien relativ zu diesem Verzeichnis.
178
114
 
179
- ## Dokumentationsverlauf
115
+ ## Dokumentationshistorie
180
116
 
181
- | Version | Datum | Änderungen |
182
- | ------- | ---------- | ----------------- |
183
- | 5.5.10 | 2025-06-29 | Verlauf initiiert |
117
+ | Version | Datum | Änderungen |
118
+ | ------- | ---------- | --------------------------------------------- |
119
+ | 6.1.5 | 2025-09-30 | Demo-GIF hinzugefügt |
120
+ | 6.1.0 | 2025-09-24 | Abschnitt zur Umgebungs-Auswahl hinzugefügt |
121
+ | 6.0.0 | 2025-09-22 | Intlayer-Tab / Befehle zum Ausfüllen & Testen |
122
+ | 5.5.10 | 2025-06-29 | Historie initialisiert |
@@ -0,0 +1,186 @@
1
+ ---
2
+ createdAt: 2024-03-07
3
+ updatedAt: 2025-09-30
4
+ title: Make a component multilingual (i18n library) in React and Next.js
5
+ description: Learn how to declare and retrieve localized content to build a multilingual React or Next.js component with Intlayer.
6
+ keywords:
7
+ - i18n
8
+ - component
9
+ - react
10
+ - multilingual
11
+ - next.js
12
+ - intlayer
13
+ slugs:
14
+ - doc
15
+ - component
16
+ - i18n
17
+ applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
18
+ youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
19
+ ---
20
+
21
+ # How to make a component multilingual (i18n) with Intlayer
22
+
23
+ This guide shows the minimal steps to make a UI component multilingual in two common setups:
24
+
25
+ - React (Vite/SPA)
26
+ - Next.js (App Router)
27
+
28
+ You will first declare your content, then retrieve it in your component.
29
+
30
+ ## 1) Declare your content (shared for React and Next.js)
31
+
32
+ Create a content declaration file near your component. This keeps translations close to where they are used and enables type safety.
33
+
34
+ ```ts fileName="component.content.ts"
35
+ import { t, type Dictionary } from "intlayer";
36
+
37
+ const componentContent = {
38
+ key: "component-example",
39
+ content: {
40
+ title: t({
41
+ en: "Hello",
42
+ fr: "Bonjour",
43
+ es: "Hola",
44
+ }),
45
+ description: t({
46
+ en: "A multilingual React component",
47
+ fr: "Un composant React multilingue",
48
+ es: "Un componente React multilingüe",
49
+ }),
50
+ },
51
+ } satisfies Dictionary;
52
+
53
+ export default componentContent;
54
+ ```
55
+
56
+ JSON is also supported if you prefer configuration files.
57
+
58
+ ```json fileName="component.content.json"
59
+ {
60
+ "$schema": "https://intlayer.org/schema.json",
61
+ "key": "component-example",
62
+ "content": {
63
+ "title": {
64
+ "nodeType": "translation",
65
+ "translation": { "en": "Hello", "fr": "Bonjour", "es": "Hola" }
66
+ },
67
+ "description": {
68
+ "nodeType": "translation",
69
+ "translation": {
70
+ "en": "A multilingual React component",
71
+ "fr": "Un composant React multilingue",
72
+ "es": "Un componente React multilingüe"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## 2) Retrieve your content
80
+
81
+ ### Case A — React app (Vite/SPA)
82
+
83
+ Default approach: use `useIntlayer` to retrieve by key. This keeps components lean and typed.
84
+
85
+ ```tsx fileName="ComponentExample.tsx"
86
+ import { useIntlayer } from "react-intlayer";
87
+
88
+ export function ComponentExample() {
89
+ const content = useIntlayer("component-example");
90
+ return (
91
+ <div>
92
+ <h1>{content.title}</h1>
93
+ <p>{content.description}</p>
94
+ </div>
95
+ );
96
+ }
97
+ ```
98
+
99
+ Server-side rendering or outside provider: use `react-intlayer/server` and pass an explicit `locale` when needed.
100
+
101
+ ```tsx fileName="ServerRenderedExample.tsx"
102
+ import { useIntlayer } from "react-intlayer/server";
103
+
104
+ export function ServerRenderedExample({ locale }: { locale: string }) {
105
+ const content = useIntlayer("component-example", locale);
106
+ return (
107
+ <>
108
+ <h1>{content.title}</h1>
109
+ <p>{content.description}</p>
110
+ </>
111
+ );
112
+ }
113
+ ```
114
+
115
+ Alternative: `useDictionary` can read a whole declared object if you prefer collocating structure at call site.
116
+
117
+ ```tsx fileName="ComponentWithDictionary.tsx"
118
+ import { useDictionary } from "react-intlayer";
119
+ import componentContent from "./component.content";
120
+
121
+ export function ComponentWithDictionary() {
122
+ const { title, description } = useDictionary(componentContent);
123
+ return (
124
+ <div>
125
+ <h1>{title}</h1>
126
+ <p>{description}</p>
127
+ </div>
128
+ );
129
+ }
130
+ ```
131
+
132
+ ### Case B — Next.js (App Router)
133
+
134
+ Prefer server components for data safety and performance. Use `useIntlayer` from `next-intlayer/server` in server files, and `useIntlayer` from `next-intlayer` in client components.
135
+
136
+ ```tsx fileName="app/[locale]/example/ServerComponent.tsx"
137
+ import { useIntlayer } from "next-intlayer/server";
138
+
139
+ export default function ServerComponent() {
140
+ const content = useIntlayer("component-example");
141
+ return (
142
+ <>
143
+ <h1>{content.title}</h1>
144
+ <p>{content.description}</p>
145
+ </>
146
+ );
147
+ }
148
+ ```
149
+
150
+ ```tsx fileName="app/[locale]/example/ClientComponent.tsx"
151
+ "use client";
152
+
153
+ import { useIntlayer } from "next-intlayer";
154
+
155
+ export function ClientComponent() {
156
+ const content = useIntlayer("component-example");
157
+ return (
158
+ <div>
159
+ <h1>{content.title}</h1>
160
+ <p>{content.description}</p>
161
+ </div>
162
+ );
163
+ }
164
+ ```
165
+
166
+ Tip: For page metadata and SEO, you can also fetch content using `getIntlayer` and generate multilingual URLs via `getMultilingualUrls`.
167
+
168
+ ## Why Intlayer’s component approach is best
169
+
170
+ - **Collocation**: Content declarations live near components, reducing drift and improving reuse across design systems.
171
+ - **Type safety**: Keys and structures are strongly typed; missing translations surface at build-time rather than at runtime.
172
+ - **Server-first**: Works natively in server components for better security and performance; client hooks remain ergonomic.
173
+ - **Tree-shaking**: Only content used by the component is bundled, keeping payloads small in large apps.
174
+ - **DX & tooling**: Built-in middleware, SEO helpers, and optional Visual Editor/AI translations streamline everyday work.
175
+
176
+ See the comparisons and patterns in the Next.js-focused roundup: https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
177
+
178
+ ## Related guides and references
179
+
180
+ - React setup (Vite): https://intlayer.org/doc/environment/vite-and-react
181
+ - React Router v7: https://intlayer.org/doc/environment/vite-and-react/react-router-v7
182
+ - TanStack Start: https://intlayer.org/doc/environment/vite-and-react/tanstack-start
183
+ - Next.js setup: https://intlayer.org/doc/environment/nextjs
184
+ - Why Intlayer vs. next-intl vs. next-i18next: https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
185
+
186
+ These pages include end-to-end setup, providers, routing, and SEO helpers.
@@ -1398,7 +1398,23 @@ Link.displayName = 'Link';
1398
1398
 
1399
1399
  By integrating this `Link` component across your application, you maintain a coherent and language-aware user experience while also benefitting from improved SEO and usability.
1400
1400
 
1401
- ### (Optional) Step 12: Optmize your bundle size
1401
+ ### (Optional) Step 12: Get the current locale in Server Actions
1402
+
1403
+ If you need the active locale inside a Server Action (e.g., to localize emails or run locale-aware logic), call `getLocale` from `next-intlayer/server`:
1404
+
1405
+ ```tsx fileName="src/app/actions/getLocale.ts" codeFormat="typescript"
1406
+ "use server";
1407
+
1408
+ import { getLocale } from "next-intlayer/server";
1409
+
1410
+ export const myServerAction = async () => {
1411
+ const locale = await getLocale();
1412
+
1413
+ // Do something with the locale
1414
+ };
1415
+ ```
1416
+
1417
+ ### (Optional) Step 13: Optmize your bundle size
1402
1418
 
1403
1419
  When using `next-intlayer`, dictionaries are included in the bundle for every page by default. To optimize bundle size, Intlayer provides an optional SWC plugin that intelligently replace `useIntlayer` calls using macros. This ensures dictionaries are only included in bundles for pages that actually use them.
1404
1420
 
@@ -1474,6 +1490,7 @@ To go further, you can implement the [visual editor](https://github.com/aymericz
1474
1490
 
1475
1491
  | Version | Date | Changes |
1476
1492
  | ------- | ---------- | --------------------------------------------------------------- |
1493
+ | 5.6.6 | 2025-10-02 | Added docs for `getLocale` function on server actions |
1477
1494
  | 5.6.2 | 2025-09-22 | Added docs for `multipleMiddlewares` helper |
1478
1495
  | 5.6.0 | 2025-07-06 | Transform `withIntlayer()` function to a promise based function |
1479
1496
  | 5.5.10 | 2025-06-29 | Init history |
@@ -1445,7 +1445,23 @@ const Link = ({ href, children, ...props }) => {
1445
1445
 
1446
1446
  By integrating this `Link` component across your application, you maintain a coherent and language-aware user experience while also benefitting from improved SEO and usability.
1447
1447
 
1448
- ### (Optional) Step 12: Optmize your bundle size
1448
+ ### (Optional) Step 12: Get the current locale in Server Actions
1449
+
1450
+ If you need the active locale inside a Server Action (e.g., to localize emails or run locale-aware logic), call `getLocale` from `next-intlayer/server`:
1451
+
1452
+ ```tsx fileName="src/app/actions/getLocale.ts" codeFormat="typescript"
1453
+ "use server";
1454
+
1455
+ import { getLocale } from "next-intlayer/server";
1456
+
1457
+ export const myServerAction = async () => {
1458
+ const locale = await getLocale();
1459
+
1460
+ // Do something with the locale
1461
+ };
1462
+ ```
1463
+
1464
+ ### (Optional) Step 13: Optmize your bundle size
1449
1465
 
1450
1466
  When using `next-intlayer`, dictionaries are included in the bundle for every page by default. To optimize bundle size, Intlayer provides an optional SWC plugin that intelligently replace `useIntlayer` calls using macros. This ensures dictionaries are only included in bundles for pages that actually use them.
1451
1467
 
@@ -1537,6 +1553,7 @@ To go further, you can implement the [visual editor](https://github.com/aymericz
1537
1553
 
1538
1554
  | Version | Date | Changes |
1539
1555
  | ------- | ---------- | --------------------------------------------------------------- |
1556
+ | 5.6.6 | 2025-10-02 | Added docs for `getLocale` function on server actions |
1540
1557
  | 5.6.2 | 2025-09-23 | Added docs for watch dictionaries changes on Turbopack |
1541
1558
  | 5.6.2 | 2025-09-22 | Added docs for `multipleMiddlewares` helper |
1542
1559
  | 5.6.0 | 2025-07-06 | Transform `withIntlayer()` function to a promise based function |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-03-17
3
- updatedAt: 2025-09-22
3
+ updatedAt: 2025-09-30
4
4
  title: Official VS Code Extension
5
5
  description: Learn how to use the Intlayer extension in VS Code to enhance your development workflow. Quickly navigate between localized content and manage your dictionaries efficiently.
6
6
  keywords:
@@ -23,92 +23,36 @@ slugs:
23
23
 
24
24
  [**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) is the official Visual Studio Code extension for **Intlayer**, designed to improve the developer experience when working with localized content in your projects.
25
25
 
26
- ![Intlayer VS Code Extension](https://github.com/aymericzip/intlayer/blob/main/docs/assets/vs_code_extension_demo.gif)
26
+ ![Intlayer VS Code Extension](https://github.com/aymericzip/intlayer/blob/main/docs/assets/vs_code_extension_demo.gif?raw=true)
27
27
 
28
28
  Extension link: [https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension)
29
29
 
30
30
  ## Features
31
31
 
32
- ### Instant Navigation
32
+ ![Fill dictionaries](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_fill_active_dictionary.gif?raw=true)
33
33
 
34
- **Go to Definition Support** – Use `⌘ + Click` (Mac) or `Ctrl + Click` (Windows/Linux) on a `useIntlayer` key to open the corresponding content file instantly.
35
- **Seamless Integration** – Works effortlessly with **react-intlayer** and **next-intlayer** projects.
36
- **Multi-language Support** – Supports localized content across different languages.
37
- **VS Code Integration** – Smoothly integrates with VS Code’s navigation and command palette.
34
+ - **Instant Navigation** – Quickly jump to the correct content file when clicking on a `useIntlayer` key.
35
+ - **Fill Dictionaries** – Fill dictionaries with content from your project.
38
36
 
39
- ### Dictionary Management Commands
37
+ ![List commands](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_list_commands.gif?raw=true)
40
38
 
41
- Manage your content dictionaries directly from VS Code:
39
+ - **Easy access to Intlayer Commands** – Build, push, pull, fill, test content dictionaries with ease.
42
40
 
43
- - **Build Dictionaries** – Generate content files based on your project structure.
44
- - **Push Dictionaries** – Upload the latest dictionary content to your repository.
45
- - **Pull Dictionaries** – Sync the latest dictionary content from your repository to your local environment.
46
- - **Fill Dictionaries** – Populate dictionaries with content from your project.
47
- - **Test Dictionaries** – Identify missing or incomplete translations.
41
+ ![Create content file](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_create_content_file.gif?raw=true)
48
42
 
49
- ### Content Declaration Generator
43
+ - **Content Declaration Generator** – Create dictionary content files in various formats (`.ts`, `.esm`, `.cjs`, `.json`).
50
44
 
51
- Easily generate structured dictionary files in different formats:
45
+ ![Test dictionaties](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_test_missing_dictionary.gif?raw=true)
52
46
 
53
- If you're currently working on a component, it will generate the `.content.{ts,tsx,js,jsx,mjs,cjs,json}` file for you.
47
+ - **Test Dictionaries** Test dictionaries for missing translations.
54
48
 
55
- Example of component:
49
+ ![Rebuild dictionary](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_rebuild_dictionary.gif?raw=true)
56
50
 
57
- ```tsx fileName="src/components/MyComponent/index.tsx"
58
- const MyComponent = () => {
59
- const { myTranslatedContent } = useIntlayer("my-component");
51
+ - **Keep your dictionaries up to date** – Keep your dictionaries up to date with the latest content from your project.
60
52
 
61
- return <span>{myTranslatedContent}</span>;
62
- };
63
- ```
64
-
65
- Generated file in TypeScript format:
66
-
67
- ```tsx fileName="src/components/MyComponent/index.content.ts"
68
- import { t, type Dictionary } from "intlayer";
69
-
70
- const componentContent = {
71
- key: "my-component",
72
- content: {
73
- myTranslatedContent: t({
74
- en: "Hello World",
75
- es: "Hola Mundo",
76
- fr: "Bonjour le monde",
77
- }),
78
- },
79
- };
53
+ ![Intlayer Tab (Activity Bar)](https://github.com/aymericzip/intlayer-vs-code-extension/blob/master/assets/vscode_extention_search_dictionary.gif?raw=true)
80
54
 
81
- export default componentContent;
82
- ```
83
-
84
- Available formats:
85
-
86
- - **TypeScript (`.ts`)**
87
- - **ES Module (`.esm`)**
88
- - **CommonJS (`.cjs`)**
89
- - **JSON (`.json`)**
90
-
91
- ### Intlayer Tab (Activity Bar)
92
-
93
- Open the Intlayer tab by clicking the Intlayer icon in the VS Code Activity Bar. It contains two views:
94
-
95
- - **Search**: A live search bar to quickly filter dictionaries and their content. Typing updates the results instantly.
96
- - **Dictionaries**: A tree view of your environments/projects, dictionary keys, and the files contributing entries. You can:
97
- - Click a file to open it in the editor.
98
- - Use the toolbar to run actions: Build, Pull, Push, Fill, Refresh, Test, and Create Dictionary File.
99
- - Use the context menu for item‑specific actions:
100
- - On a dictionary: Pull or Push
101
- - On a file: Fill Dictionary
102
- - When you switch editors, the tree will reveal the matching file if it belongs to a dictionary.
103
-
104
- ## Installation
105
-
106
- You can install **Intlayer** directly from the VS Code Marketplace:
107
-
108
- 1. Open **VS Code**.
109
- 2. Go to the **Extensions Marketplace**.
110
- 3. Search for **"Intlayer"**.
111
- 4. Click **Install**.
55
+ - **Intlayer Tab (Activity Bar)** – Browse and search dictionaries from a dedicated side tab with toolbar and context actions (Build, Pull, Push, Fill, Refresh, Test, Create File).
112
56
 
113
57
  ## Usage
114
58
 
@@ -124,8 +68,6 @@ You can install **Intlayer** directly from the VS Code Marketplace:
124
68
  3. **Command-click** (`⌘+Click` on macOS) or **Ctrl+Click** (on Windows/Linux) on the key (e.g., `"app"`).
125
69
  4. VS Code will automatically open the corresponding dictionary file, e.g., `src/app.content.ts`.
126
70
 
127
- ### Managing Content Dictionaries
128
-
129
71
  ### Intlayer Tab (Activity Bar)
130
72
 
131
73
  Use the side tab to browse and manage dictionaries:
@@ -134,47 +76,20 @@ Use the side tab to browse and manage dictionaries:
134
76
  - In **Search**, type to filter dictionaries and entries in real time.
135
77
  - In **Dictionaries**, browse environments, dictionaries, and files. Use the toolbar for Build, Pull, Push, Fill, Refresh, Test, and Create Dictionary File. Right‑click for context actions (Pull/Push on dictionaries, Fill on files). The current editor file auto‑reveals in the tree when applicable.
136
78
 
137
- #### Building Dictionaries
79
+ ### Accessing the commands
138
80
 
139
- Generate all dictionary content files with:
81
+ You can access the commands from the **Command Palette**.
140
82
 
141
83
  ```sh
142
84
  Cmd + Shift + P (macOS) / Ctrl + Shift + P (Windows/Linux)
143
85
  ```
144
86
 
145
- Search for **Build Dictionaries** and execute the command.
146
-
147
- #### Pushing Dictionaries
148
-
149
- Upload the latest dictionary content:
150
-
151
- 1. Open the **Command Palette**.
152
- 2. Search for **Push Dictionaries**.
153
- 3. Select the dictionaries to push and confirm.
154
-
155
- #### Pulling Dictionaries
156
-
157
- Sync the latest dictionary content:
158
-
159
- 1. Open the **Command Palette**.
160
- 2. Search for **Pull Dictionaries**.
161
- 3. Choose the dictionaries to pull.
162
-
163
- #### Filling Dictionaries
164
-
165
- Fill dictionaries with content from your project:
166
-
167
- 1. Open the **Command Palette**.
168
- 2. Search for **Fill Dictionaries**.
169
- 3. Run the command to populate dictionaries.
170
-
171
- #### Testing Dictionaries
172
-
173
- Validate dictionaries and find missing translations:
174
-
175
- 1. Open the **Command Palette**.
176
- 2. Search for **Test Dictionaries**.
177
- 3. Review the reported issues and fix as needed.
87
+ - **Build Dictionaries**
88
+ - **Push Dictionaries**
89
+ - **Pull Dictionaries**
90
+ - **Fill Dictionaries**
91
+ - **Test Dictionaries**
92
+ - **Create Dictionary File**
178
93
 
179
94
  ### Loading Environment Variables
180
95
 
@@ -197,16 +112,11 @@ The extension can load environment variables from your workspace to run Intlayer
197
112
 
198
113
  If your `.env` files live outside the workspace root, set the **Base Directory** in `Settings → Extensions → Intlayer`. The loader will look for `.env` files relative to that directory.
199
114
 
200
- #### Notes
201
-
202
- - The extension loads the first matching file and keeps any existing variables intact.
203
- - You’ll see an info message each time a file is successfully loaded.
204
- - If no candidate file is found, commands still run with your current environment variables.
205
-
206
115
  ## Doc History
207
116
 
208
117
  | Version | Date | Changes |
209
118
  | ------- | ---------- | ----------------------------------- |
119
+ | 6.1.5 | 2025-09-30 | Add demo gif |
210
120
  | 6.1.0 | 2025-09-24 | Added environment selection section |
211
121
  | 6.0.0 | 2025-09-22 | Intlayer Tab / Fill & Test commands |
212
122
  | 5.5.10 | 2025-06-29 | Init history |