internationalization

A set of project rules for internationalization (i18n), which means preparing an application to show its text in multiple languages. It uses react-intl to store, extract, normalize, and compile translation messages.

In plain words
What is it for?
Use it when adding or changing translated messages in components and pages. It covers language files, extracting messages from code, and compiling them for runtime use.
Why use it?
It keeps translation text organized and provides the commands needed to update the language files used by the application.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/thematters/matters-web/internationalization
Clone the repo
git clone --depth 1 https://github.com/thematters/matters-web

Made for: Cursor.

Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 581 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00023 $0.00581
Opus 5 $0.00012 $0.00291
Sonnet 5 $0.00005 $0.00116
Haiku 4.5 $0.00002 $0.00058

Measured 2d ago against content hash 2a0ad7139332, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

internationalization scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/internationalization.mdc · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Internationalization (i18n)

Matters Web uses react-intl (FormatJS) for internationalization.

i18n Structure

  • lang/: Contains language files
  • compiled-lang/: Contains compiled language files used at runtime
  • Language strings are extracted from components and pages using formatjs

Translation Management

  • The application uses a set of scripts to manage translations:
    • npm run i18n:extract: Extracts messages from the codebase to lang/
    • npm run i18n:generate: Normalize language files to lang/
    • npm run i18n:compile: Compiles language files to compiled-lang/ for use in the application
    • npm run i18n: Runs all i18n commands

Usage in Components

Components use the FormattedMessage component or the useIntl hook to access translations:

// Using FormattedMessage
<FormattedMessage
  defaultMessage="Archived"
  id="a/YQ1Z"
  description="src/components/ArticleDigest/DropdownActions/ArchiveArticle/Dialog.tsx"
/>

// Using useIntl
const intl = useIntl()
const message = intl.formatMessage({
  defaultMessage: 'Archived'
  id="a/YQ1Z"
  description="src/components/ArticleDigest/DropdownActions/ArchiveArticle/Dialog.tsx"
})

The id is an automatically generated hash that uniquely identifies each translatable message. The description field contains the relative path of the component file, which helps prevent ID collisions when the same defaultMessage appears in multiple components. This enables accurate message tracking and context-specific translations throughout the application.

Translation Workflow

  1. Add copy with <FormattedMessage> or intl.formatMessage in your component
  2. Run npm run i18n to generate language files
  3. Add corresponding translations to lang/zh-Hans.json and lang/zh-Hant.json
  4. Run npm run i18n to compile the language files

Language Files

The main language files:

Read the full file on GitHub · 66 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 66 lines · 23 tokens per session scan A 2a0ad7139332

Subscribe to this mod's changes

internationalization is a cursor rule published in the GitHub repository thematters/matters-web (86 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 23 tokens to every session and 581 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.