Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ape Add Translations?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/buffape-ape-add-translations)
---
name: ape-add-translations
description: "Add or change words people read: t() with ICU messages, the English and Spanish catalogs, Intl formats, ape i18n check and translate, pseudo-locales."
---
# Add translations
Every word a person reads goes through `t('module.area.key', values)`; every date, number and amount goes through `Intl` (`formatDate`, `formatMoney` and the others in `@buffcore/i18n`). A moment shows with `formatDateTime(locale, iso)`, in the viewer's zone; a day with no time (`'2026-10-13'`) with `formatDate(locale, day)`, as that day in every zone (the convention: `docs/LOCALIZATION.md`). A screen gets `locale` from `useLocale()` (`@buffcore/i18n/react`).
The module's own catalog holds the words its **server** sends: a route's error sentence (`flushOrConflict(em, 'groups.errors.nameTaken')`), a notification, an action's title. It is not the screens' words (their catalogs are in step 3). Words no module owns, such as a plan's name in the `settings` that `defineApp` gives payments, go in the composition's own `catalogs: [{ en, es }]` in `apps/api/src/app.ts` (keys start with the product's name, `myapp.plans.plus`); `ape i18n check` reads them with the modules'.
1. Add the English source to `apps/api/src/modules/<key>/locales/en.ts` (in BuffCore, `packages/modules/src/<key>/locales/en.ts`): a default export of `'<key>.<area>.<name>': 'text'` entries, `satisfies Record<string, string>`, every key starting with the module key. Use ICU for plurals and choices: `{count, plural, one {# note} other {# notes}}`.
2. Add every key to each offered language's JSON beside it (`locales/es.json`), with the same placeholders.
3. Pass both in the manifest (a JSON import needs `with { type: 'json' }`); the answer's `message` is then in the reader's language:
```ts
import en from './locales/en.ts';
import es from './locales/es.json' with { type: 'json' };
// …in defineModule({ … }):
catalog: { en, es },
```
- Screens have their own catalogs: the console's in `apps/admin/src/i18n/en.ts`, the app's in `apps/app/src/i18n/en.ts`, each with a JSON per language beside it (`es.json`); a big one splits by area (`home.en.ts` and `home.es.json` in the same `src/i18n`). They are passed as `catalogs: [{ en, es }]` to `createAdmin` and `createAppShell`.
- A native app bundles Intl data only for the product's configured languages: they feed `pnpm ape i18n generate`, which writes `src/i18n/intl-locales.gen.ts` in the app. Run it when the languages change; `pnpm ape i18n check` flags a stale file.
4. Run `pnpm ape i18n check` and `pnpm ape i18n extract` (keys used in code but defined nowhere). The check fails on a missing key or a broken placeholder in a language the product offers: in the server's catalogs, in the screens' catalogs, in each granted extension's console and app catalogs, and for each key the admin's or the app's code uses in `t('…')`, which must be in their catalog or the shell's. A screen string written only in English fails it.
5. Check layouts with the pseudo-locales: `en-XA` (accented, about 35% longer) finds hard-coded strings and truncation; `ar-XB` finds right-to-left breakage (only if the product offers a right-to-left language). In a view test, build the translator with `pseudo: true` and render a view without data in `en-XA`: every catalog word comes out accented, so plain letters left over are a string that skipped `t()`.
```ts
const translator = createI18n({ catalogs: [{ en, es }], locale: 'en-XA', pseudo: true });
expect(container.textContent).not.toMatch(/[A-Za-z]{2,}/);
```
`createI18n` is from `@buffcore/i18n`; the admin's views add `adminCatalog` from `@buffcore/admin-shell` to `catalogs`. `apps/app/src/screens/TasksView.test.tsx` and `apps/admin/src/views.test.tsx` are examples.
6. Layouts use start and end, never left and right. Legal text is translated by a qualified person, never by AI alone.
7. To draft a new language's missing strings with AI (development only, needs `generation`): `pnpm ape i18n translate es` starts a translation run and waits for the worker (`ape dev` starts it); approve its set in Inbox › Reviews (`pnpm ape review approve <set>` in development); `pnpm ape i18n pull es` writes the approved strings into the JSON catalogs, never over one written by hand; then `pnpm ape i18n check`. The product's QA playbook holds its voice rules. Strings BuffCore owns are listed, not written: add those to your own catalog by hand.