Add react i18next to console

Signed-off-by: Jonathan <contact@grafikart.fr>
This commit is contained in:
Jonathan
2026-07-21 16:09:41 +02:00
committed by Bryan Frimin
parent 1b7b2594eb
commit a7ff5f07bc
420 changed files with 10251 additions and 6825 deletions

View File

@@ -116,7 +116,24 @@ new Intl.NumberFormat(i18n.language, { style: "percent" }).format(ratio);
`${day}/${month}/${year}`;
```
Reuse `@probo/helpers` only for its **non-presentational** date utilities — parsing and `<input type="date">` shaping (`parseDate`, `toDateInput`, `todayAsDateInput`). Do not use its v1 `formatDate` / `formatDuration` helpers in v2 apps: they predate i18next and thread the legacy `@probo/i18n` `__` translator. Format for display through i18next / `Intl` instead.
### Shared formatting helpers
Use the shared formatting helpers instead of duplicating their parsing and unit-selection logic:
- `formatDate(dateInput)` from `@probo/helpers` formats a date for display using the runtime locale.
- `formatDuration(duration, t)` from `@probo/i18n` formats a supported ISO 8601 duration. Pass the i18next `t` function so pluralization remains in the catalog; it uses `duration.min` and `duration.hour` with `count`.
- `fileSize(bytes, t)` from `@probo/i18n` formats a byte count using the translated `size.B`, `size.KB`, `size.MB`, `size.GB`, and `size.TB` units.
```tsx
import { fileSize, formatDuration } from "@probo/i18n";
import { formatDate } from "@probo/helpers";
const { t } = useTranslation();
formatDate(document.createdAt);
formatDuration(task.timeEstimate, t);
fileSize(attachment.size, t);
```
## Loading catalogs