@commercetools/nimbus-i18n 1.0.1 → 2.0.1

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
@@ -1,10 +1,14 @@
1
- # @commercetools-nimbus/i18n
1
+ # @commercetools/nimbus-i18n
2
2
 
3
3
  This package contains all translation messages from the Nimbus design system
4
4
  components. It's a **pure data package** that provides centralized
5
5
  internationalization support for accessibility labels, tooltips, and user-facing
6
6
  text across all Nimbus components.
7
7
 
8
+ > 📖 **For i18n development information (adding messages, extraction workflow,
9
+ > etc.), see the
10
+ > [Nimbus README](../nimbus/README.md#internationalization-i18n-development)**
11
+
8
12
  ## Package Type
9
13
 
10
14
  This is a **data-only package** - it contains no code, only translation files in
@@ -21,11 +25,7 @@ multiple formats. It's designed to be consumed directly by importing JSON files.
21
25
  ## Installation
22
26
 
23
27
  ```bash
24
- pnpm add @commercetools-nimbus/i18n
25
- # or
26
- npm install @commercetools-nimbus/i18n
27
- # or
28
- yarn add @commercetools-nimbus/i18n
28
+ pnpm add @commercetools/nimbus-i18n
29
29
  ```
30
30
 
31
31
  ## Usage
@@ -44,170 +44,3 @@ Examples:
44
44
 
45
45
  - `Nimbus.PasswordInput.show` - Show password button
46
46
  - `Nimbus.DatePicker.clearInput` - Clear input button
47
-
48
- ## Development
49
-
50
- ### Adding New Messages
51
-
52
- TL;DR version:
53
-
54
- - Create a new `.i18n.ts` file in the component's directory and add the new
55
- message(s) to it.
56
- - Be specific with the message description, these are used to help translators
57
- understand the context of the message.
58
- - Run `pnpm extract-intl` to update the `core.json` file.
59
- - Test in Storybook to ensure the locale is working as expected.
60
-
61
- ---
62
-
63
- 1. Create or update a component's `.i18n.ts` file:
64
-
65
- ```typescript
66
- // packages/nimbus/src/components/button/button.i18n.ts
67
- import { defineMessages } from "react-intl";
68
-
69
- export default defineMessages({
70
- buttonLabel: {
71
- id: "Nimbus.Button.buttonLabel",
72
- description: "Label for the main action button",
73
- defaultMessage: "Click me",
74
- },
75
- });
76
- ```
77
-
78
- 2. Use the messages in your component:
79
-
80
- ```typescript
81
- // packages/nimbus/src/components/button/button.tsx
82
- import { FormattedMessage } from 'react-intl';
83
- import messages from './button.i18n';
84
-
85
- export const Button = () => (
86
- <button>
87
- <FormattedMessage {...messages.buttonLabel} />
88
- </button>
89
- );
90
- ```
91
-
92
- ### Extracting Messages
93
-
94
- Extract all messages from component files and compile them:
95
-
96
- ```bash
97
- pnpm extract-intl
98
- ```
99
-
100
- This command performs two operations in sequence:
101
-
102
- 1. **Extracts** translation messages from all `.i18n.ts` files throughout the
103
- codebase
104
- 2. **Compiles** the extracted messages into optimized AST format for
105
- distribution
106
-
107
- The process:
108
-
109
- - Scans all `.i18n.ts` files and updates `packages/i18n/data/core.json`
110
- - Converts files in `data/` to optimized versions in `compiled-data/`
111
-
112
- > [!IMPORTANT]
113
- > Run `extract-intl` before merging your changes so that Transifex knows about
114
- > new translation keys that need to be translated.
115
-
116
- ### Building Translation Data
117
-
118
- The i18n package has its own build process that compiles translation data:
119
-
120
- ```bash
121
- pnpm --filter @commercetools-nimbus/i18n build
122
- ```
123
-
124
- This converts files in `data/` to optimized versions in `compiled-data/` for
125
- distribution.
126
-
127
- > [!NOTE]
128
- > The i18n build process is automatically run during the main build process
129
- > (`pnpm build`) via `build:packages`, so compiled translation data is always
130
- > up-to-date in built packages.
131
-
132
- ## File Structure
133
-
134
- //TODO
135
-
136
- ## Translation Workflow
137
-
138
- The i18n workflow involves two main scenarios: development (adding new keys) and
139
- building (compiling for distribution).
140
-
141
- ### Development Workflow
142
-
143
- When developers add new translation keys to components:
144
-
145
- ```mermaid
146
-
147
- A[Developer adds .i18n.ts files] --> B[Run: pnpm extract-intl]
148
- B --> C[Extract keys to core.json]
149
- C --> D[Compile to compiled-data/]
150
- D --> E[Commit changes]
151
- E --> F[Transifex gets new keys]
152
- ```
153
-
154
- ### Build Workflow
155
-
156
- When building the project for distribution:
157
-
158
- ```mermaid
159
- A[Run: pnpm build] --> B[build:packages runs]
160
- B --> C[i18n package build script]
161
- C --> D[Compile existing data]
162
- D --> E[Ready for distribution]
163
- ```
164
-
165
- ### Script Interaction
166
-
167
- | Script | Purpose | When to Use | What it Does |
168
- | ---------------------- | ------------------ | -------------------------------- | -------------------------------------------------------------------------------------- |
169
- | `extract-intl` | Extract + Compile | When adding new translation keys | 1. Scans `.i18n.ts` files<br>2. Updates `core.json`<br>3. Compiles to `compiled-data/` |
170
- | `build` (i18n package) | Compile only | Automatically during build | Compiles existing translation data |
171
- | `build:packages` | Build all packages | During main build | Runs `build` script in all packages including i18n |
172
-
173
- ### Key Points
174
-
175
- - **Extract workflow**: Use `extract-intl` when adding new translation keys
176
- - **Build workflow**: Compilation happens automatically during `pnpm build`
177
- - **No manual compilation**: The build system handles compilation automatically
178
- - **Transifex integration**: New keys are available for translation after
179
- running `extract-intl`
180
-
181
- ## Integration with App-Kit
182
-
183
- To add Nimbus translations to the Merchant Center App-Kit, update the
184
- `load-i18n.ts` file:
185
-
186
- //TODO
187
-
188
- ## Best Practices
189
-
190
- ### Accessibility Guidelines
191
-
192
- //TODO
193
-
194
- ### Message Naming
195
-
196
- //TODO
197
-
198
- ```
199
-
200
- ## Contributing
201
-
202
- //TODO
203
- # add diagram
204
- # review Text intlMessage prop
205
- # preconstruct build?
206
- # i18n dist folder
207
- # add to changesets
208
- # automated prs?
209
- # order of operations
210
-
211
-
212
- MIT
213
- ```
@@ -47,6 +47,24 @@
47
47
  "value": "Close dialog"
48
48
  }
49
49
  ],
50
+ "Nimbus.DraggableList.emptyMessage": [
51
+ {
52
+ "type": 0,
53
+ "value": "drop items here"
54
+ }
55
+ ],
56
+ "Nimbus.DraggableList.removeButtonLabel": [
57
+ {
58
+ "type": 0,
59
+ "value": "remove item"
60
+ }
61
+ ],
62
+ "Nimbus.Drawer.closeTrigger": [
63
+ {
64
+ "type": 0,
65
+ "value": "Close drawer"
66
+ }
67
+ ],
50
68
  "Nimbus.FieldErrors.duplicateValue": [
51
69
  {
52
70
  "type": 0,
package/data/core.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "Nimbus.Alert.dismiss": {
3
- "developer_comment": "aria-label for dismiss button in alert",
3
+ "developer_comment": "aria-label for the dismiss button in an alert",
4
4
  "string": "Dismiss"
5
5
  },
6
6
  "Nimbus.DatePicker.Time.enterTime": {
@@ -31,6 +31,18 @@
31
31
  "developer_comment": "aria-label for the default close trigger button",
32
32
  "string": "Close dialog"
33
33
  },
34
+ "Nimbus.DraggableList.emptyMessage": {
35
+ "developer_comment": "message displayed when drag-and-drop enabled list is empty",
36
+ "string": "drop items here"
37
+ },
38
+ "Nimbus.DraggableList.removeButtonLabel": {
39
+ "developer_comment": "label for button that removes an item from the list",
40
+ "string": "remove item"
41
+ },
42
+ "Nimbus.Drawer.closeTrigger": {
43
+ "developer_comment": "aria-label for the default close trigger button",
44
+ "string": "Close drawer"
45
+ },
34
46
  "Nimbus.FieldErrors.duplicateValue": {
35
47
  "developer_comment": "Error message for duplicate value validation",
36
48
  "string": "This value is already in use. It must be unique."
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools/nimbus-i18n",
3
3
  "description": "All translation messages from the Nimbus design system.",
4
- "version": "1.0.1",
4
+ "version": "2.0.1",
5
5
  "bugs": "https://github.com/commercetools/nimbus/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,4 +27,4 @@
27
27
  "scripts": {
28
28
  "build": "pnpm dlx @formatjs/cli compile-folder --format=transifex --ast data compiled-data"
29
29
  }
30
- }
30
+ }