React translations
React-översättningar
Use normal translation calls in your components, let Keykit discover the keys automatically and stop treating locale-file synchronization as a separate development workflow.
The component should stay simple
Localization should not make every component understand how translations are stored, synchronized or generated.
import { useKeykit } from '@keykithq/sdk/react';
export function EmptyState() {
const { translate } = useKeykit();
return (
<section>
<h2>{translate('projects.empty.title', 'No projects yet')}</h2>
<p>{translate('projects.empty.description', 'Create a project to get started.')}</p>
</section>
);
}The React component only asks for the translations it needs. Keykit handles the translation-key workflow around those calls.
Adding a new string should be part of adding the feature
When a developer introduces a translated label, there should not be a second checklist item saying to register that key somewhere else.
1. Add the translation call in React.
2. Keykit discovers the new key.
3. Missing languages become visible and can be translated.
4. The application consumes the translation using the project's delivery mode.
Option 1: load translations live
With delivery: "live", the React application can load translation data from Keykit rather than depending on checked-in locale files.
Translation changes can move independently from application source changes.
Option 2: keep translations static
If you prefer translation resources to be bundled with the application, set delivery: "static" and pull the latest translations with the CLI.
Keykit project → CLI pull → static locale resources → React build
npx @keykithq/cli pull
A small React example
Keykit can discover both static translation identifiers from the component. The developer does not need to mirror those keys manually in a second system before continuing the feature.
export function ProjectHeader({ project }) {
const { translate } = useKeykit();
return (
<header>
<span>{translate('projects.header.eyebrow', 'Project')}</span>
<h1>{project.name}</h1>
<Button>{translate('projects.actions.edit', 'Edit')}</Button>
</header>
);
}React translation FAQ
Does React have built-in translation support?
React itself does not provide a complete localization system. Applications need a translation strategy for locale selection, formatting and message lookup.
Do I need locale JSON files?
Not necessarily. Keykit can support a live delivery model, while teams that prefer static resources can pull translations into the application with the CLI.
How does Keykit find translation keys in React?
Keykit analyzes supported translation calls and records static keys referenced by the connected source.
What happens when I delete a component containing translations?
Keys that were previously detected but disappear from source can be marked as no longer detected or deprecated for review.
Write the translation call and keep building
Let Keykit handle discovery, translation state and stale-key detection around your React application.
Use Keykit with React