business-obligations-ui 0.1.0 → 0.2.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.
- package/README.md +33 -0
- package/dist/index.cjs +360 -146
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -5
- package/dist/index.d.ts +99 -5
- package/dist/index.js +357 -145
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -11,3 +11,36 @@ import { planLaunch, evaluate } from "business-obligations";
|
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
The components are controlled: the host owns completed steps and obligation filters.
|
|
14
|
+
|
|
15
|
+
## Languages
|
|
16
|
+
|
|
17
|
+
English is the default and Spanish ships with the package. Two things are translated, by two packages:
|
|
18
|
+
|
|
19
|
+
- **Interface text** (labels, buttons, chips, filters) and the formatting of dates, money and relative times, here, with
|
|
20
|
+
the `locale` prop.
|
|
21
|
+
- **Data text** (titles, descriptions, reasons, deadlines) in `business-obligations`, with `localizePlan` or `localize`
|
|
22
|
+
and the bundled Spanish catalog.
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { planLaunch, localizePlan, localize } from "business-obligations";
|
|
26
|
+
import { es } from "business-obligations/locales/es";
|
|
27
|
+
|
|
28
|
+
const plan = localizePlan(planLaunch(profile), es);
|
|
29
|
+
const result = localize(evaluate(profile), es);
|
|
30
|
+
|
|
31
|
+
<LaunchList plan={plan} costs={plan.costs} locale="es" />
|
|
32
|
+
<ObligationsList items={result.items} asOf={result.asOf} filters={filters} onFilters={setFilters} locale="es" />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`locale="es"` formats like US Spanish (`$1,250.00`, `15 oct 2026`). Search ignores case and accents, so "licencia"
|
|
36
|
+
finds "Licencia". For another language pass its tag and a full table:
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { messages, type Messages } from "business-obligations-ui";
|
|
40
|
+
|
|
41
|
+
const fr: Messages = { ...messages.en, fileFormation: "Constitution", knownFees: "Frais connus" /* ... */ };
|
|
42
|
+
<LaunchList plan={plan} locale="fr" messages={fr} />;
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
`messages.en` and `messages.es` are the bundled tables, and `getMessages("es-MX")` picks one from a locale code.
|
|
46
|
+
Text from the data stays in English until it goes through `localize` / `localizePlan`.
|