Skip to content

Commit 60d02c4

Browse files
authored
docs(@inquirer/prompts): highlight auto-detected locale in i18n section (#2011)
Lead with the root `@inquirer/i18n` import and locale auto-detection rather than fixed sub-path imports, which are a secondary use case.
1 parent f773d21 commit 60d02c4

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/prompts/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,17 @@ import { rawlist } from '@inquirer/prompts';
172172

173173
# Internationalization (i18n)
174174

175-
Need prompts in a language other than English? The [`@inquirer/i18n`](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/i18n) package is a drop-in replacement for `@inquirer/prompts` with built-in support for multiple languages.
175+
Need prompts in a language other than English? The [`@inquirer/i18n`](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/i18n) package is a drop-in replacement for `@inquirer/prompts` with built-in localization.
176+
177+
The root import automatically detects your locale from the `LANGUAGE`, `LC_ALL`, `LC_MESSAGES`, and `LANG` environment variables (falling back to the `Intl` API). If no supported locale is found, English is used.
176178

177179
```js
178-
// Drop-in replacement — same API, translated UI labels
179-
import { input, select, confirm } from '@inquirer/i18n/fr'; // French
180-
import { input, select, confirm } from '@inquirer/i18n/zh'; // Chinese (Simplified)
180+
// Drop-in replacement — locale is auto-detected from environment variables
181+
import { input, select, confirm } from '@inquirer/i18n';
181182
```
182183

184+
Built-in locales include English, French, Spanish, Chinese (Simplified), and Portuguese. You can also pin to a specific language via sub-path imports (e.g. `@inquirer/i18n/fr`), or use the `createLocalizedPrompts` and `registerLocale` APIs to add your own.
185+
183186
[See the full documentation](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/i18n) for available languages and how to create a custom locale.
184187

185188
# Create your own prompts

0 commit comments

Comments
 (0)