Skip to content

Commit 25051d0

Browse files
committed
feat(@inquirer/prompts-i18n) New i18n package with first set of localization
1 parent 8a985d5 commit 25051d0

File tree

13 files changed

+863
-4
lines changed

13 files changed

+863
-4
lines changed
Binary file not shown.

packages/prompts-i18n/README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<img width="75px" height="75px" align="right" alt="Inquirer Logo" src="https://raw.githubusercontent.com/SBoudrias/Inquirer.js/main/assets/inquirer_readme.svg?sanitize=true" title="Inquirer.js"/>
2+
3+
# @inquirer/prompts-i18n
4+
5+
[![npm](https://badge.fury.io/js/@inquirer%2Fprompts-i18n.svg)](https://www.npmjs.com/package/@inquirer/prompts-i18n)
6+
7+
Internationalized Inquirer prompts - 100% drop-in replacements for `@inquirer/prompts` with built-in localization support.
8+
9+
# Installation
10+
11+
<table>
12+
<tr>
13+
<th>npm</th>
14+
<th>yarn</th>
15+
<th>pnpm</th>
16+
<th>bun</th>
17+
</tr>
18+
<tr>
19+
<td>
20+
21+
```sh
22+
npm install @inquirer/prompts-i18n
23+
```
24+
25+
</td>
26+
<td>
27+
28+
```sh
29+
yarn add @inquirer/prompts-i18n
30+
```
31+
32+
</td>
33+
<td>
34+
35+
```sh
36+
pnpm add @inquirer/prompts-i18n
37+
```
38+
39+
</td>
40+
<td>
41+
42+
```sh
43+
bun add @inquirer/prompts-i18n
44+
```
45+
46+
</td>
47+
</tr>
48+
</table>
49+
50+
# Usage
51+
52+
Simply replace your import from `@inquirer/prompts` with a language-specific import:
53+
54+
```js
55+
// Before
56+
import { input, select, confirm } from '@inquirer/prompts';
57+
58+
// After (French)
59+
import { input, select, confirm } from '@inquirer/prompts-i18n/fr';
60+
61+
// After (Spanish)
62+
import { input, select, confirm } from '@inquirer/prompts-i18n/es';
63+
```
64+
65+
All prompts work exactly the same way as the original package. The only difference is that help text, validation messages, and UI labels are automatically translated to your chosen language.
66+
67+
# Supported Languages
68+
69+
- `@inquirer/prompts-i18n/en` - English (default, re-export of original)
70+
- `@inquirer/prompts-i18n/fr` - French
71+
- `@inquirer/prompts-i18n/es` - Spanish
72+
- `@inquirer/prompts-i18n/zh` - Chinese (Simplified)
73+
- `@inquirer/prompts-i18n/pr` - Portuguese
74+
75+
# Example
76+
77+
```js
78+
import { input, confirm, select } from '@inquirer/prompts-i18n/fr';
79+
80+
const name = await input({ message: 'Quel est votre nom ?' });
81+
82+
const confirmed = await confirm({ message: 'Continuer ?' });
83+
84+
const choice = await select({
85+
message: 'Choisissez une option',
86+
choices: [
87+
{ name: 'Option 1', value: 'opt1' },
88+
{ name: 'Option 2', value: 'opt2', disabled: true },
89+
],
90+
});
91+
```
92+
93+
# Available Prompts
94+
95+
All prompts from `@inquirer/prompts` are available:
96+
97+
- `input`
98+
- `select`
99+
- `checkbox`
100+
- `confirm`
101+
- `search`
102+
- `password`
103+
- `expand`
104+
- `editor`
105+
- `number`
106+
- `rawlist`
107+
- `Separator`
108+
109+
See the [@inquirer/prompts documentation](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/prompts) for full usage details.
110+
111+
# License
112+
113+
Copyright (c) 2025 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>
114+
Licensed under the MIT license.

packages/prompts-i18n/package.json

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
{
2+
"name": "@inquirer/prompts-i18n",
3+
"version": "0.0.0",
4+
"description": "Internationalized Inquirer prompts - drop-in package with i18n support",
5+
"keywords": [
6+
"answer",
7+
"answers",
8+
"ask",
9+
"base",
10+
"cli",
11+
"command",
12+
"command-line",
13+
"confirm",
14+
"enquirer",
15+
"generate",
16+
"generator",
17+
"hyper",
18+
"input",
19+
"inquire",
20+
"inquirer",
21+
"interface",
22+
"iterm",
23+
"javascript",
24+
"menu",
25+
"node",
26+
"nodejs",
27+
"prompt",
28+
"promptly",
29+
"prompts",
30+
"question",
31+
"readline",
32+
"scaffold",
33+
"scaffolder",
34+
"scaffolding",
35+
"stdin",
36+
"stdout",
37+
"terminal",
38+
"tty",
39+
"ui",
40+
"yeoman",
41+
"yo",
42+
"zsh",
43+
"internationalization",
44+
"i18n",
45+
"localization",
46+
"l10n",
47+
"types",
48+
"typescript"
49+
],
50+
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/prompts-i18n/README.md",
51+
"repository": {
52+
"type": "git",
53+
"url": "https://github.com/SBoudrias/Inquirer.js.git"
54+
},
55+
"license": "MIT",
56+
"author": "Simon Boudrias <[email protected]>",
57+
"sideEffects": false,
58+
"type": "module",
59+
"exports": {
60+
"./package.json": "./package.json",
61+
".": "./src/index.ts",
62+
"./en": "./src/locales/en.ts",
63+
"./fr": "./src/locales/fr.ts",
64+
"./zh": "./src/locales/zh.ts",
65+
"./pr": "./src/locales/pr.ts",
66+
"./es": "./src/locales/es.ts"
67+
},
68+
"files": [
69+
"dist"
70+
],
71+
"dependencies": {
72+
"@inquirer/core": "^10.3.0",
73+
"@inquirer/prompts": "^7.10.0"
74+
},
75+
"devDependencies": {
76+
"@inquirer/testing": "^2.1.52",
77+
"@repo/tsconfig": "workspace:*",
78+
"typescript": "^5.9.3"
79+
},
80+
"engines": {
81+
"node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
82+
},
83+
"peerDependencies": {
84+
"@types/node": ">=18"
85+
},
86+
"peerDependenciesMeta": {
87+
"@types/node": {
88+
"optional": true
89+
}
90+
},
91+
"publishConfig": {
92+
"access": "public",
93+
"exports": {
94+
"./package.json": "./package.json",
95+
"./en": {
96+
"types": "./dist/locales/en.d.ts",
97+
"default": "./dist/locales/en.js"
98+
},
99+
"./fr": {
100+
"types": "./dist/locales/fr.d.ts",
101+
"default": "./dist/locales/fr.js"
102+
},
103+
"./zh": {
104+
"types": "./dist/locales/zh.d.ts",
105+
"default": "./dist/locales/zh.js"
106+
},
107+
"./pr": {
108+
"types": "./dist/locales/pr.d.ts",
109+
"default": "./dist/locales/pr.js"
110+
},
111+
"./es": {
112+
"types": "./dist/locales/es.d.ts",
113+
"default": "./dist/locales/es.js"
114+
},
115+
".": {
116+
"types": "./dist/index.d.ts",
117+
"default": "./dist/index.js"
118+
}
119+
}
120+
},
121+
"scripts": {
122+
"tsc": "tsc"
123+
}
124+
}

0 commit comments

Comments
 (0)