@inquirer/i18n 1.3.2 → 1.3.4

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.
package/README.md CHANGED
@@ -10,43 +10,61 @@ Internationalized Inquirer prompts — a 100% drop-in replacement for `@inquirer
10
10
 
11
11
  <table>
12
12
  <tr>
13
- <th>npm</th>
14
13
  <th>yarn</th>
15
14
  <th>pnpm</th>
16
- <th>bun</th>
17
15
  </tr>
18
16
  <tr>
19
17
  <td>
20
18
 
21
19
  ```sh
22
- npm install @inquirer/i18n
20
+ yarn add @inquirer/i18n
23
21
  ```
24
22
 
25
23
  </td>
26
24
  <td>
27
25
 
28
26
  ```sh
29
- yarn add @inquirer/i18n
27
+ pnpm add @inquirer/i18n
30
28
  ```
31
29
 
32
30
  </td>
31
+ </tr>
32
+ <tr>
33
+ <th>bun</th>
34
+ <th>deno</th>
35
+ </tr>
36
+ <tr>
33
37
  <td>
34
38
 
35
39
  ```sh
36
- pnpm add @inquirer/i18n
40
+ bun add @inquirer/i18n
37
41
  ```
38
42
 
39
43
  </td>
40
44
  <td>
41
45
 
42
46
  ```sh
43
- bun add @inquirer/i18n
47
+ deno add npm:@inquirer/i18n
48
+ ```
49
+
50
+ </td>
51
+ </tr>
52
+ <tr>
53
+ <th colSpan="2">npm</th>
54
+ </tr>
55
+ <tr>
56
+ <td colSpan="2">
57
+
58
+ ```sh
59
+ npm install @inquirer/i18n
44
60
  ```
45
61
 
46
62
  </td>
47
63
  </tr>
48
64
  </table>
49
65
 
66
+ On Deno, locale detection reads the `LANGUAGE`, `LC_ALL`, `LC_MESSAGES`, and `LANG` environment variables, so run your script with `--allow-env`.
67
+
50
68
  # Usage
51
69
 
52
70
  ## Auto-detected locale
package/dist/create.js CHANGED
@@ -17,6 +17,7 @@ export function createLocalizedPrompts(locale) {
17
17
  keywords: {
18
18
  yes: locale.confirm.yesLabel,
19
19
  no: locale.confirm.noLabel,
20
+ error: ({ yes, no }) => locale.confirm.invalidAnswer(yes, no),
20
21
  },
21
22
  };
22
23
  return confirmPrompt({ ...config, theme }, context);
@@ -8,6 +8,10 @@ export declare const confirm: (this: void, config: {
8
8
  keywords: {
9
9
  yes: string;
10
10
  no: string;
11
+ error: (keywords: {
12
+ yes: string;
13
+ no: string;
14
+ }) => string;
11
15
  };
12
16
  style: {
13
17
  confirmDefault: (text: string) => string;
@@ -21,6 +25,10 @@ export declare const confirm: (this: void, config: {
21
25
  keywords: {
22
26
  yes: string;
23
27
  no: string;
28
+ error: (keywords: {
29
+ yes: string;
30
+ no: string;
31
+ }) => string;
24
32
  };
25
33
  style: {
26
34
  confirmDefault: (text: string) => string;
@@ -3,6 +3,7 @@ export const locale = {
3
3
  confirm: {
4
4
  yesLabel: 'Sí',
5
5
  noLabel: 'No',
6
+ invalidAnswer: (si, no) => `Responde con "${si}" o "${no}"`,
6
7
  },
7
8
  select: {
8
9
  helpNavigate: 'navegar',
@@ -8,6 +8,10 @@ export declare const confirm: (this: void, config: {
8
8
  keywords: {
9
9
  yes: string;
10
10
  no: string;
11
+ error: (keywords: {
12
+ yes: string;
13
+ no: string;
14
+ }) => string;
11
15
  };
12
16
  style: {
13
17
  confirmDefault: (text: string) => string;
@@ -21,6 +25,10 @@ export declare const confirm: (this: void, config: {
21
25
  keywords: {
22
26
  yes: string;
23
27
  no: string;
28
+ error: (keywords: {
29
+ yes: string;
30
+ no: string;
31
+ }) => string;
24
32
  };
25
33
  style: {
26
34
  confirmDefault: (text: string) => string;
@@ -3,6 +3,7 @@ export const locale = {
3
3
  confirm: {
4
4
  yesLabel: 'Oui',
5
5
  noLabel: 'Non',
6
+ invalidAnswer: (oui, non) => `Répondez avec « ${oui} » ou « ${non} »`,
6
7
  },
7
8
  select: {
8
9
  helpNavigate: 'naviguer',
@@ -8,6 +8,10 @@ export declare const confirm: (this: void, config: {
8
8
  keywords: {
9
9
  yes: string;
10
10
  no: string;
11
+ error: (keywords: {
12
+ yes: string;
13
+ no: string;
14
+ }) => string;
11
15
  };
12
16
  style: {
13
17
  confirmDefault: (text: string) => string;
@@ -21,6 +25,10 @@ export declare const confirm: (this: void, config: {
21
25
  keywords: {
22
26
  yes: string;
23
27
  no: string;
28
+ error: (keywords: {
29
+ yes: string;
30
+ no: string;
31
+ }) => string;
24
32
  };
25
33
  style: {
26
34
  confirmDefault: (text: string) => string;
@@ -3,6 +3,7 @@ export const locale = {
3
3
  confirm: {
4
4
  yesLabel: 'Sim',
5
5
  noLabel: 'Não',
6
+ invalidAnswer: (sim, nao) => `Responda com "${sim}" ou "${nao}"`,
6
7
  },
7
8
  select: {
8
9
  helpNavigate: 'navegar',
@@ -8,6 +8,10 @@ export declare const confirm: (this: void, config: {
8
8
  keywords: {
9
9
  yes: string;
10
10
  no: string;
11
+ error: (keywords: {
12
+ yes: string;
13
+ no: string;
14
+ }) => string;
11
15
  };
12
16
  style: {
13
17
  confirmDefault: (text: string) => string;
@@ -21,6 +25,10 @@ export declare const confirm: (this: void, config: {
21
25
  keywords: {
22
26
  yes: string;
23
27
  no: string;
28
+ error: (keywords: {
29
+ yes: string;
30
+ no: string;
31
+ }) => string;
24
32
  };
25
33
  style: {
26
34
  confirmDefault: (text: string) => string;
@@ -3,6 +3,7 @@ export const locale = {
3
3
  confirm: {
4
4
  yesLabel: '是',
5
5
  noLabel: '否',
6
+ invalidAnswer: (yes, no) => `请输入“${yes}”或“${no}”`,
6
7
  },
7
8
  select: {
8
9
  helpNavigate: '导航',
package/dist/types.d.ts CHANGED
@@ -6,6 +6,8 @@ export interface ConfirmStrings {
6
6
  yesLabel: string;
7
7
  /** Label for "No" — also the keyword accepted as "no" (prefix-matched) */
8
8
  noLabel: string;
9
+ /** Message shown when the submitted input matches no keyword (receives the localized labels) */
10
+ invalidAnswer: (yesLabel: string, noLabel: string) => string;
9
11
  }
10
12
  /**
11
13
  * Localized strings for the select prompt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/i18n",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Internationalized Inquirer prompts - drop-in package with i18n support",
5
5
  "keywords": [
6
6
  "answer",
@@ -97,8 +97,8 @@
97
97
  "tsc": "tsc"
98
98
  },
99
99
  "dependencies": {
100
- "@inquirer/core": "^12.0.3",
101
- "@inquirer/prompts": "^8.7.2"
100
+ "@inquirer/core": "^12.0.5",
101
+ "@inquirer/prompts": "^8.7.4"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@repo/tsconfig": "0.0.0",
@@ -117,5 +117,5 @@
117
117
  },
118
118
  "main": "./dist/index.js",
119
119
  "types": "./dist/index.d.ts",
120
- "gitHead": "cbdb34bfc6c245941d80ef88493c50b3d6dbfce6"
120
+ "gitHead": "ea3130ebc609a6a3910b5397244044de7eda3d05"
121
121
  }