@inquirer/i18n 1.0.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.
@@ -0,0 +1,209 @@
1
+ export declare const confirm: (this: void, config: {
2
+ message: string;
3
+ default?: boolean;
4
+ transformer?: (value: boolean) => string;
5
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme>;
6
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<boolean>, select: <Value>(this: void, config: {
7
+ message: string;
8
+ choices: readonly (import("@inquirer/prompts").Separator | Value | {
9
+ value: Value;
10
+ name?: string;
11
+ description?: string;
12
+ short?: string;
13
+ disabled?: boolean | string;
14
+ type?: never;
15
+ })[];
16
+ pageSize?: number | undefined;
17
+ loop?: boolean | undefined;
18
+ default?: NoInfer<Value> | undefined;
19
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
20
+ icon: {
21
+ cursor: string;
22
+ };
23
+ style: {
24
+ disabled: (text: string) => string;
25
+ description: (text: string) => string;
26
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
27
+ };
28
+ i18n: {
29
+ disabledError: string;
30
+ };
31
+ indexMode: "hidden" | "number";
32
+ keybindings: ReadonlyArray<import("@inquirer/core").Keybinding>;
33
+ }>> | undefined;
34
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, checkbox: <Value>(this: void, config: {
35
+ message: string;
36
+ prefix?: string | undefined;
37
+ pageSize?: number | undefined;
38
+ choices: readonly (string | import("@inquirer/prompts").Separator)[] | readonly (import("@inquirer/prompts").Separator | {
39
+ value: Value;
40
+ name?: string;
41
+ checkedName?: string;
42
+ description?: string;
43
+ short?: string;
44
+ disabled?: boolean | string;
45
+ checked?: boolean;
46
+ type?: never;
47
+ })[];
48
+ loop?: boolean | undefined;
49
+ required?: boolean | undefined;
50
+ validate?: ((choices: readonly {
51
+ value: Value;
52
+ name: string;
53
+ checkedName: string;
54
+ description?: string;
55
+ short: string;
56
+ disabled: boolean | string;
57
+ checked: boolean;
58
+ }[]) => boolean | string | Promise<string | boolean>) | undefined;
59
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
60
+ icon: {
61
+ checked: string;
62
+ unchecked: string;
63
+ cursor: string;
64
+ disabledChecked: string;
65
+ disabledUnchecked: string;
66
+ };
67
+ style: {
68
+ disabled: (text: string) => string;
69
+ renderSelectedChoices: <T>(selectedChoices: ReadonlyArray<{
70
+ value: T;
71
+ name: string;
72
+ checkedName: string;
73
+ description?: string;
74
+ short: string;
75
+ disabled: boolean | string;
76
+ checked: boolean;
77
+ }>, allChoices: ReadonlyArray<{
78
+ value: T;
79
+ name: string;
80
+ checkedName: string;
81
+ description?: string;
82
+ short: string;
83
+ disabled: boolean | string;
84
+ checked: boolean;
85
+ } | import("@inquirer/prompts").Separator>) => string;
86
+ description: (text: string) => string;
87
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
88
+ };
89
+ i18n: {
90
+ disabledError: string;
91
+ };
92
+ keybindings: ReadonlyArray<import("@inquirer/core").Keybinding>;
93
+ }>> | undefined;
94
+ shortcuts?: {
95
+ all?: string | null;
96
+ invert?: string | null;
97
+ } | undefined;
98
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Value[]>, search: <Value>(this: void, config: {
99
+ message: string;
100
+ source: (term: string | undefined, opt: {
101
+ signal: AbortSignal;
102
+ }) => readonly (string | import("@inquirer/prompts").Separator)[] | Promise<readonly (string | import("@inquirer/prompts").Separator)[]> | readonly (import("@inquirer/prompts").Separator | {
103
+ value: Value;
104
+ name?: string;
105
+ description?: string;
106
+ short?: string;
107
+ disabled?: boolean | string;
108
+ type?: never;
109
+ })[] | Promise<readonly (import("@inquirer/prompts").Separator | {
110
+ value: Value;
111
+ name?: string;
112
+ description?: string;
113
+ short?: string;
114
+ disabled?: boolean | string;
115
+ type?: never;
116
+ })[]>;
117
+ validate?: ((value: Value) => boolean | string | Promise<string | boolean>) | undefined;
118
+ pageSize?: number | undefined;
119
+ default?: NoInfer<Value> | undefined;
120
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
121
+ icon: {
122
+ cursor: string;
123
+ };
124
+ style: {
125
+ disabled: (text: string) => string;
126
+ searchTerm: (text: string) => string;
127
+ description: (text: string) => string;
128
+ keysHelpTip: (keys: [key: string, action: string][]) => string | undefined;
129
+ };
130
+ }>> | undefined;
131
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, expand: <Value>(this: void, config: {
132
+ message: string;
133
+ choices: readonly {
134
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
135
+ name: string;
136
+ }[] | readonly (import("@inquirer/prompts").Separator | ({
137
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
138
+ value: Value;
139
+ } | {
140
+ key: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
141
+ name: string;
142
+ value: Value;
143
+ }))[];
144
+ default?: (("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "k" | "p" | "j" | "n" | "f" | "s" | "i" | "a" | "b" | "c" | "d" | "e" | "g" | "l" | "m" | "o" | "q" | "r" | "t" | "u" | "v" | "w" | "x" | "y" | "z") | "h") | undefined;
145
+ expanded?: boolean | undefined;
146
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme> | undefined;
147
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, rawlist: <Value>(this: void, config: {
148
+ message: string;
149
+ choices: readonly (import("@inquirer/prompts").Separator | Value | {
150
+ value: Value;
151
+ name?: string;
152
+ short?: string;
153
+ key?: string;
154
+ description?: string;
155
+ })[];
156
+ loop?: boolean | undefined;
157
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
158
+ style: {
159
+ description: (text: string) => string;
160
+ };
161
+ }>> | undefined;
162
+ default?: NoInfer<Value> | undefined;
163
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>, editor: (this: void, config: {
164
+ message: string;
165
+ default?: string;
166
+ postfix?: string;
167
+ waitForUserInput?: boolean;
168
+ validate?: (value: string) => boolean | string | Promise<string | boolean>;
169
+ file?: import("@inquirer/external-editor").IFileOptions;
170
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
171
+ validationFailureMode: "keep" | "clear";
172
+ style: {
173
+ waitingMessage: (enterKey: string) => string;
174
+ };
175
+ }>>;
176
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<string>, input: (this: void, config: {
177
+ message: string;
178
+ default?: string;
179
+ prefill?: "tab" | "editable";
180
+ required?: boolean;
181
+ transformer?: (value: string, { isFinal }: {
182
+ isFinal: boolean;
183
+ }) => string;
184
+ validate?: (value: string) => boolean | string | Promise<string | boolean>;
185
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
186
+ validationFailureMode: "keep" | "clear";
187
+ }>>;
188
+ pattern?: RegExp;
189
+ patternError?: string;
190
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<string>, number: <Required extends boolean = boolean>(this: void, config: {
191
+ message: string;
192
+ default?: number | undefined;
193
+ min?: number | undefined;
194
+ max?: number | undefined;
195
+ step?: number | "any" | undefined;
196
+ required?: Required | undefined;
197
+ validate?: ((value: Required extends true ? number : number | undefined) => boolean | string | Promise<string | boolean>) | undefined;
198
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme> | undefined;
199
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Required extends true ? number : number | undefined>, password: (this: void, config: {
200
+ message: string;
201
+ mask?: boolean | string;
202
+ validate?: (value: string) => boolean | string | Promise<string | boolean>;
203
+ theme?: import("@inquirer/type").PartialDeep<import("@inquirer/core").Theme<{
204
+ style: {
205
+ maskedText: string;
206
+ };
207
+ }>>;
208
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<string>;
209
+ export { Separator } from '@inquirer/prompts';
@@ -0,0 +1,32 @@
1
+ import { createLocalizedPrompts } from "../create.js";
2
+ const zhLocale = {
3
+ confirm: {
4
+ yesLabel: '是',
5
+ noLabel: '否',
6
+ hintYes: '是/否',
7
+ hintNo: '是/否',
8
+ },
9
+ select: {
10
+ helpNavigate: '导航',
11
+ helpSelect: '选择',
12
+ },
13
+ checkbox: {
14
+ helpNavigate: '导航',
15
+ helpSelect: '选择',
16
+ helpSubmit: '提交',
17
+ helpAll: '全选',
18
+ helpInvert: '反选',
19
+ },
20
+ search: {
21
+ helpNavigate: '导航',
22
+ helpSelect: '选择',
23
+ },
24
+ editor: {
25
+ waitingMessage: (enterKey) => `按 ${enterKey} 键启动您的首选编辑器。`,
26
+ },
27
+ password: {
28
+ maskedText: '[输入已隐藏]',
29
+ },
30
+ };
31
+ export const { confirm, select, checkbox, search, expand, rawlist, editor, input, number, password, } = createLocalizedPrompts(zhLocale);
32
+ export { Separator } from '@inquirer/prompts';
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Localized strings for the confirm prompt
3
+ */
4
+ export interface ConfirmStrings {
5
+ /** Default label for "Yes" option */
6
+ yesLabel: string;
7
+ /** Default label for "No" option */
8
+ noLabel: string;
9
+ /** Hint text when default is true (e.g., "Y/n") */
10
+ hintYes: string;
11
+ /** Hint text when default is false (e.g., "y/N") */
12
+ hintNo: string;
13
+ }
14
+ /**
15
+ * Localized strings for the select prompt
16
+ */
17
+ export interface SelectStrings {
18
+ /** Help text for navigation keys */
19
+ helpNavigate: string;
20
+ /** Help text for selection key */
21
+ helpSelect: string;
22
+ }
23
+ /**
24
+ * Localized strings for the checkbox prompt
25
+ */
26
+ export interface CheckboxStrings {
27
+ /** Help text for navigation keys */
28
+ helpNavigate: string;
29
+ /** Help text for selection key */
30
+ helpSelect: string;
31
+ /** Help text for submit key */
32
+ helpSubmit: string;
33
+ /** Help text for "select all" key */
34
+ helpAll: string;
35
+ /** Help text for "invert selection" key */
36
+ helpInvert: string;
37
+ }
38
+ /**
39
+ * Localized strings for the search prompt
40
+ */
41
+ export interface SearchStrings {
42
+ /** Help text for navigation keys */
43
+ helpNavigate: string;
44
+ /** Help text for selection key */
45
+ helpSelect: string;
46
+ }
47
+ /**
48
+ * Localized strings for the editor prompt
49
+ */
50
+ export interface EditorStrings {
51
+ /** Message shown while waiting for user to open editor (receives formatted enter key) */
52
+ waitingMessage: (enterKey: string) => string;
53
+ }
54
+ /**
55
+ * Localized strings for the password prompt
56
+ */
57
+ export interface PasswordStrings {
58
+ /** Text shown instead of typed input to indicate it is hidden */
59
+ maskedText: string;
60
+ }
61
+ /**
62
+ * Complete locale definition containing all prompt strings
63
+ */
64
+ export interface Locale {
65
+ confirm: ConfirmStrings;
66
+ select: SelectStrings;
67
+ checkbox: CheckboxStrings;
68
+ search: SearchStrings;
69
+ editor: EditorStrings;
70
+ password: PasswordStrings;
71
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "@inquirer/i18n",
3
+ "version": "1.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
+ "i18n",
19
+ "input",
20
+ "inquire",
21
+ "inquirer",
22
+ "interface",
23
+ "internationalization",
24
+ "iterm",
25
+ "javascript",
26
+ "l10n",
27
+ "localization",
28
+ "menu",
29
+ "node",
30
+ "nodejs",
31
+ "prompt",
32
+ "promptly",
33
+ "prompts",
34
+ "question",
35
+ "readline",
36
+ "scaffold",
37
+ "scaffolder",
38
+ "scaffolding",
39
+ "stdin",
40
+ "stdout",
41
+ "terminal",
42
+ "tty",
43
+ "types",
44
+ "typescript",
45
+ "ui",
46
+ "yeoman",
47
+ "yo",
48
+ "zsh"
49
+ ],
50
+ "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/i18n/README.md",
51
+ "license": "MIT",
52
+ "author": "Simon Boudrias <admin@simonboudrias.com>",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "https://github.com/SBoudrias/Inquirer.js.git"
56
+ },
57
+ "files": [
58
+ "dist"
59
+ ],
60
+ "type": "module",
61
+ "sideEffects": false,
62
+ "exports": {
63
+ "./package.json": "./package.json",
64
+ ".": {
65
+ "types": "./dist/index.d.ts",
66
+ "default": "./dist/index.js"
67
+ },
68
+ "./create": {
69
+ "types": "./dist/create.d.ts",
70
+ "default": "./dist/create.js"
71
+ },
72
+ "./en": {
73
+ "types": "./dist/locales/en.d.ts",
74
+ "default": "./dist/locales/en.js"
75
+ },
76
+ "./fr": {
77
+ "types": "./dist/locales/fr.d.ts",
78
+ "default": "./dist/locales/fr.js"
79
+ },
80
+ "./zh": {
81
+ "types": "./dist/locales/zh.d.ts",
82
+ "default": "./dist/locales/zh.js"
83
+ },
84
+ "./pt": {
85
+ "types": "./dist/locales/pt.d.ts",
86
+ "default": "./dist/locales/pt.js"
87
+ },
88
+ "./es": {
89
+ "types": "./dist/locales/es.d.ts",
90
+ "default": "./dist/locales/es.js"
91
+ }
92
+ },
93
+ "publishConfig": {
94
+ "access": "public"
95
+ },
96
+ "scripts": {
97
+ "tsc": "tsc"
98
+ },
99
+ "dependencies": {
100
+ "@inquirer/core": "^11.1.5",
101
+ "@inquirer/prompts": "^8.3.0"
102
+ },
103
+ "devDependencies": {
104
+ "@inquirer/testing": "^3.3.0",
105
+ "typescript": "^5.9.3"
106
+ },
107
+ "peerDependencies": {
108
+ "@types/node": ">=18"
109
+ },
110
+ "peerDependenciesMeta": {
111
+ "@types/node": {
112
+ "optional": true
113
+ }
114
+ },
115
+ "engines": {
116
+ "node": ">=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0"
117
+ },
118
+ "main": "./dist/index.js",
119
+ "types": "./dist/index.d.ts",
120
+ "gitHead": "526eca2e64853510821ffd457561840ec0cbfb93"
121
+ }