Enforce i18n for User-Facing Strings
Flags hard-coded labels, headings, error messages, and placeholders in UI code that bypass t() or useTranslation, while ignoring logs and technical IDs.
What it flags
export function CartSummary({ items, onCheckout }: CartSummaryProps) {
return (
<section>
<h2>Your cart</h2>
{/* Hard-coded copy, and a plural built from a template string */}
<p>{`${items.length} items`}</p>
<input aria-label="Discount code" placeholder="Enter a code" />
<button type="button" onClick={onCheckout}>
Checkout
</button>
{items.length === 0 && <p>Your cart is empty.</p>}
</section>
);
}import { useTranslation } from 'react-i18next';
export function CartSummary({ items, onCheckout }: CartSummaryProps) {
const { t } = useTranslation('cart');
return (
<section>
<h2>{t('title')}</h2>
<p>{t('itemCount', { count: items.length })}</p>
<input
aria-label={t('discountCode.label')}
placeholder={t('discountCode.placeholder')}
/>
<button type="button" onClick={onCheckout}>
{t('checkout')}
</button>
{items.length === 0 && <p>{t('empty')}</p>}
</section>
);
}Why it matters
Hard-coded strings are the part of localization that keeps growing back: each new screen adds a few, and translators never see them because they are not in the message catalog. The result is a half-translated product, most visibly in error states and empty states that nobody checks in every locale. Strings assembled with template literals fail in another way, because word order and plural rules differ between languages and translating the fragments cannot fix them.
Agent instructions
cubic checks every pull request against these instructions. Paste them into AGENTS.md or Cursor rules and your AI coding tool follows them while it writes code.
AGENTS.md
Add this section to AGENTS.md at the repository root. Codex, Cursor, and other AI coding tools read it.
## Enforce i18n for User-Facing Strings All user-visible text must be wrapped in translation function calls (t(), useTranslation, etc.). This includes button labels, headings, error messages, and placeholder text. Raw string literals in JSX or template strings should be replaced with translation keys. Exception: Technical identifiers and logging messages.
Checks every changed file.
Included in the React code review standards.
Run this agent on every pull request
cubic reviews every pull request against the agents you turn on and comments on the lines that break them.