-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(@inquirer/prompts-i18n) New i18n package with first set of localization #1892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SBoudrias
wants to merge
1
commit into
main
Choose a base branch
from
next/i18n-package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+843
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| <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"/> | ||
|
|
||
| # @inquirer/prompts-i18n | ||
|
|
||
| [](https://www.npmjs.com/package/@inquirer/prompts-i18n) | ||
|
|
||
| Internationalized Inquirer prompts - 100% drop-in replacements for `@inquirer/prompts` with built-in localization support. | ||
|
|
||
| # Installation | ||
|
|
||
| <table> | ||
| <tr> | ||
| <th>npm</th> | ||
| <th>yarn</th> | ||
| <th>pnpm</th> | ||
| <th>bun</th> | ||
| </tr> | ||
| <tr> | ||
| <td> | ||
|
|
||
| ```sh | ||
| npm install @inquirer/prompts-i18n | ||
| ``` | ||
|
|
||
| </td> | ||
| <td> | ||
|
|
||
| ```sh | ||
| yarn add @inquirer/prompts-i18n | ||
| ``` | ||
|
|
||
| </td> | ||
| <td> | ||
|
|
||
| ```sh | ||
| pnpm add @inquirer/prompts-i18n | ||
| ``` | ||
|
|
||
| </td> | ||
| <td> | ||
|
|
||
| ```sh | ||
| bun add @inquirer/prompts-i18n | ||
| ``` | ||
|
|
||
| </td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| # Usage | ||
|
|
||
| Simply replace your import from `@inquirer/prompts` with a language-specific import: | ||
|
|
||
| ```js | ||
| // Before | ||
| import { input, select, confirm } from '@inquirer/prompts'; | ||
|
|
||
| // After (French) | ||
| import { input, select, confirm } from '@inquirer/prompts-i18n/fr'; | ||
|
|
||
| // After (Spanish) | ||
| import { input, select, confirm } from '@inquirer/prompts-i18n/es'; | ||
| ``` | ||
|
|
||
| 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. | ||
|
|
||
| # Supported Languages | ||
|
|
||
| - `@inquirer/prompts-i18n/en` - English (default, re-export of original) | ||
| - `@inquirer/prompts-i18n/fr` - French | ||
| - `@inquirer/prompts-i18n/es` - Spanish | ||
| - `@inquirer/prompts-i18n/zh` - Chinese (Simplified) | ||
| - `@inquirer/prompts-i18n/pr` - Portuguese | ||
|
|
||
| # Example | ||
|
|
||
| ```js | ||
| import { input, confirm, select } from '@inquirer/prompts-i18n/fr'; | ||
|
|
||
| const name = await input({ message: 'Quel est votre nom ?' }); | ||
|
|
||
| const confirmed = await confirm({ message: 'Continuer ?' }); | ||
|
|
||
| const choice = await select({ | ||
| message: 'Choisissez une option', | ||
| choices: [ | ||
| { name: 'Option 1', value: 'opt1' }, | ||
| { name: 'Option 2', value: 'opt2', disabled: true }, | ||
| ], | ||
| }); | ||
| ``` | ||
|
|
||
| # Available Prompts | ||
|
|
||
| All prompts from `@inquirer/prompts` are available: | ||
|
|
||
| - `input` | ||
| - `select` | ||
| - `checkbox` | ||
| - `confirm` | ||
| - `search` | ||
| - `password` | ||
| - `expand` | ||
| - `editor` | ||
| - `number` | ||
| - `rawlist` | ||
| - `Separator` | ||
|
|
||
| See the [@inquirer/prompts documentation](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/prompts) for full usage details. | ||
|
|
||
| # License | ||
|
|
||
| Copyright (c) 2025 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/> | ||
| Licensed under the MIT license. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| { | ||
| "name": "@inquirer/prompts-i18n", | ||
| "version": "0.0.0", | ||
| "description": "Internationalized Inquirer prompts - drop-in package with i18n support", | ||
| "keywords": [ | ||
| "answer", | ||
| "answers", | ||
| "ask", | ||
| "base", | ||
| "cli", | ||
| "command", | ||
| "command-line", | ||
| "confirm", | ||
| "enquirer", | ||
| "generate", | ||
| "generator", | ||
| "hyper", | ||
| "input", | ||
| "inquire", | ||
| "inquirer", | ||
| "interface", | ||
| "iterm", | ||
| "javascript", | ||
| "menu", | ||
| "node", | ||
| "nodejs", | ||
| "prompt", | ||
| "promptly", | ||
| "prompts", | ||
| "question", | ||
| "readline", | ||
| "scaffold", | ||
| "scaffolder", | ||
| "scaffolding", | ||
| "stdin", | ||
| "stdout", | ||
| "terminal", | ||
| "tty", | ||
| "ui", | ||
| "yeoman", | ||
| "yo", | ||
| "zsh", | ||
| "internationalization", | ||
| "i18n", | ||
| "localization", | ||
| "l10n", | ||
| "types", | ||
| "typescript" | ||
| ], | ||
| "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/prompts-i18n/README.md", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/SBoudrias/Inquirer.js.git" | ||
| }, | ||
| "license": "MIT", | ||
| "author": "Simon Boudrias <[email protected]>", | ||
| "sideEffects": false, | ||
| "type": "module", | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": "./src/index.ts", | ||
| "./en": "./src/locales/en.ts", | ||
| "./fr": "./src/locales/fr.ts", | ||
| "./zh": "./src/locales/zh.ts", | ||
| "./pr": "./src/locales/pr.ts", | ||
| "./es": "./src/locales/es.ts" | ||
| }, | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "dependencies": { | ||
| "@inquirer/core": "^11.0.0", | ||
| "@inquirer/prompts": "^8.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@inquirer/testing": "^3.0.0", | ||
| "@repo/tsconfig": "workspace:*", | ||
| "typescript": "^5.9.3" | ||
| }, | ||
| "engines": { | ||
| "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@types/node": ">=18" | ||
| }, | ||
| "peerDependenciesMeta": { | ||
| "@types/node": { | ||
| "optional": true | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| }, | ||
| "./en": { | ||
| "types": "./dist/locales/en.d.ts", | ||
| "default": "./dist/locales/en.js" | ||
| }, | ||
| "./fr": { | ||
| "types": "./dist/locales/fr.d.ts", | ||
| "default": "./dist/locales/fr.js" | ||
| }, | ||
| "./zh": { | ||
| "types": "./dist/locales/zh.d.ts", | ||
| "default": "./dist/locales/zh.js" | ||
| }, | ||
| "./pr": { | ||
| "types": "./dist/locales/pr.d.ts", | ||
| "default": "./dist/locales/pr.js" | ||
| }, | ||
| "./es": { | ||
| "types": "./dist/locales/es.d.ts", | ||
| "default": "./dist/locales/es.js" | ||
| } | ||
| } | ||
| }, | ||
| "scripts": { | ||
| "tsc": "tsc" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: gotta edit README and adding a contribution guide.