Skip to content

Commit 70f4438

Browse files
committed
docs(i18n): single language configuration
1 parent a70438e commit 70f4438

File tree

6 files changed

+112
-5
lines changed

6 files changed

+112
-5
lines changed

docs/content/en/1.getting-started/4.project-structure.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,20 @@ export default defineNuxtConfig({
110110
You need a `nuxt.config.ts` to be set if you want to override app configuration.
111111
::
112112

113-
This is where you can [configure Docus](/en/concepts/configuration) to fit your branding, handle SEO and adapt links and socials.
113+
This is where you can [configure Docus](/en/concepts/configuration) to fit your branding, handle SEO, set your locale, and adapt links and socials.
114+
115+
```ts [app.config.ts]
116+
export default defineAppConfig({
117+
docus: {
118+
locale: 'en', // Set your single-language locale
119+
},
120+
seo: {
121+
title: 'My Docs',
122+
description: 'My awesome documentation',
123+
},
124+
// ... other configurations
125+
})
126+
```
114127

115128
## Full Nuxt Project Capabilities
116129

docs/content/en/2.concepts/3.configuration.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,27 @@ export default defineAppConfig({
158158
})
159159
```
160160

161+
## Locale
162+
163+
For single-language documentation (without the full `@nuxtjs/i18n` module), you can configure the locale through `app.config.ts`:
164+
165+
```ts [app.config.ts]
166+
export default defineAppConfig({
167+
docus: {
168+
locale: 'fr', // Default: 'en'
169+
}
170+
})
171+
```
172+
173+
This sets the language for:
174+
- UI component translations
175+
- The `lang` and `dir` attributes on the `<html>` tag
176+
- Built-in Docus interface strings
177+
178+
::prose-tip{to="/en/concepts/internationalization"}
179+
For multi-language documentation with language switching, see the [Internationalization guide](/en/concepts/internationalization).
180+
::
181+
161182
## GitHub Integration
162183

163184
Docus reads your `.git/` folder to get the `url` and `branch` of your repository to add:

docs/content/en/2.concepts/6.internationalization.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,25 @@ Docus v4 introduces **native internationalization support** based on the `@nuxtj
1616
- **Dynamic locale routing**: Automatic URL prefixing with language codes (`/en/docs`, `/fr/docs`)
1717
- **Content collections per locale**: Separate content management for each language
1818
- **Language switcher**: Built-in component for switching between locales
19+
- **Single-language configuration**: Simple locale configuration for single-language sites via `app.config.ts`
1920

20-
## Setup an existing project
21+
## Single Language Configuration
22+
23+
If you're building documentation in a single language (without the full `@nuxtjs/i18n` module), you can configure the locale through `app.config.ts`. This is useful for setting the language for UI components and localizing built-in strings.
24+
25+
```ts [app.config.ts]
26+
export default defineAppConfig({
27+
docus: {
28+
locale: 'fr', // Set your locale (default: 'en')
29+
}
30+
})
31+
```
32+
33+
## Multi-Language Setup
34+
35+
For multi-language documentation, use the full `@nuxtjs/i18n` integration as described below.
36+
37+
### Setup an existing project
2138

2239
To enable i18n in your Docus project, add the `@nuxtjs/i18n` module to your `nuxt.config.ts` and define your locales:
2340

docs/content/fr/1.getting-started/4.project-structure.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,25 @@ export default defineNuxtConfig({
105105

106106
*Ce fichier n'est pas obligatoire pour démarrer une application Docus.*
107107

108-
C'est ici que vous pouvez [configurer Docus](/fr/concepts/configuration) pour l'adapter à votre marque, gérer le SEO et adapter les liens et réseaux sociaux.
109-
110108
::prose-warning
111109
Un fichier `nuxt.config.ts` doit être existant pour surcharger votre app config. Sans le fichier Nuxt config, vos surcharges ne seront pas prises en compte.
112110
::
113111

112+
C'est ici que vous pouvez [configurer Docus](/fr/concepts/configuration) pour l'adapter à votre marque, gérer le SEO, définir votre locale et adapter les liens et réseaux sociaux.
113+
114+
```ts [app.config.ts]
115+
export default defineAppConfig({
116+
docus: {
117+
locale: 'fr', // Définir votre locale monolingue
118+
},
119+
seo: {
120+
title: 'Ma Documentation',
121+
description: 'Ma super documentation',
122+
},
123+
// ... autres configurations
124+
})
125+
```
126+
114127
## Structure complète d'un projet Nuxt
115128

116129
Puisque Docus v4 est un layer Nuxt, vous pouvez utiliser **n'importe quelle fonctionnalité** d'un projet Nuxt standard :

docs/content/fr/2.concepts/3.configuration.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,27 @@ export default defineAppConfig({
159159
})
160160
```
161161

162+
## Locale
163+
164+
Pour une documentation monolingue (sans le module complet `@nuxtjs/i18n`), vous pouvez configurer la locale via `app.config.ts` :
165+
166+
```ts [app.config.ts]
167+
export default defineAppConfig({
168+
docus: {
169+
locale: 'fr', // Par défaut : 'en'
170+
}
171+
})
172+
```
173+
174+
Ceci définit la langue pour :
175+
- Les traductions des composants UI
176+
- Les attributs `lang` et `dir` sur la balise `<html>`
177+
- Les chaînes d'interface intégrées de Docus
178+
179+
::prose-tip{to="/fr/concepts/internationalization"}
180+
Pour une documentation multilingue avec changement de langue, consultez le [guide d'internationalisation](/fr/concepts/internationalization).
181+
::
182+
162183
## Intégration GitHub
163184

164185
Docus lit votre dossier `.git/` pour obtenir l'`url` et la `branch` de votre dépôt afin d'ajouter :

docs/content/fr/2.concepts/6.internationalization.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,30 @@ Docus v4 introduit un **support d'internationalisation natif** basé sur le modu
1515
- **Routage de locale dynamique** : Préfixage automatique des URL avec les codes de langue (`/en/docs`, `/fr/docs`)
1616
- **Collections de contenu par locale** : Gestion séparée du contenu pour chaque langue
1717
- **Sélecteur de langue** : Composant intégré pour basculer entre les locales
18+
- **Configuration monolingue** : Configuration simple de la locale pour les sites monolingues via `app.config.ts`
1819

19-
## Configurer un projet existant
20+
## Configuration monolingue
21+
22+
Si vous créez une documentation dans une seule langue (sans le module complet `@nuxtjs/i18n`), vous pouvez configurer la locale via `app.config.ts`. Ceci est utile pour définir la langue des composants UI et localiser les chaînes intégrées.
23+
24+
```ts [app.config.ts]
25+
export default defineAppConfig({
26+
docus: {
27+
locale: 'fr', // Définissez votre locale (par défaut : 'en')
28+
}
29+
})
30+
```
31+
32+
Cette configuration affecte :
33+
- Les traductions des composants UI (boutons, étiquettes, etc.)
34+
- Les attributs `lang` et `dir` sur la balise `<html>`
35+
- Les chaînes d'interface intégrées de Docus
36+
37+
## Configuration multilingue
38+
39+
Pour une documentation multilingue, utilisez l'intégration complète `@nuxtjs/i18n` comme décrit ci-dessous.
40+
41+
### Configurer un projet existant
2042

2143
Pour activer l'i18n dans votre projet Docus, ajoutez le module `@nuxtjs/i18n` à votre `nuxt.config.ts` et définissez vos locales :
2244

0 commit comments

Comments
 (0)