Skip to content
Back to skills

Ape Add Translations

ASecurity

Add or change words people read: t() with ICU messages, the English and Spanish catalogs, Intl formats, ape i18n check and translate, pseudo-locales.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
developmentgoshellreactapi

Works with

  • api

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add BuffApe/BuffApe --skill ape-add-translations --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ape Add Translations?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ape Add Translations
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/buffape-ape-add-translations/badge)](https://www.skillsdirectory.com/skills/buffape-ape-add-translations)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.