nocobase-app-plugin-i18n
Ce qu’il fait
Cette skill guide l'ajout et la modification de textes traduits dans une application ou un plugin NocoBase 3. Elle s'adresse aux développeurs qui ont besoin que l'application fonctionne dans plusieurs langues.
Quand l’utiliser
- ✓Quand vous ajoutez un nouveau libellé, bouton ou message qui doit apparaître dans plusieurs langues.
- ✓Quand vous devez traduire des erreurs serveur ou des e-mails dans la langue du destinataire.
- ✓Quand vous voulez ajouter une nouvelle langue à un paquet qui contient déjà des fichiers de locale.
Lien du skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-i18n/skills/nocobase-app-plugin-i18n/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Je voudrais traduire le nouveau bouton Enregistrer et les messages d'erreur de mon application NocoBase en portugais et en espagnol.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'IA place le texte derrière une clé de traduction, dans le bon fichier de locale et le bon espace de noms. Elle affiche ensuite le texte grâce aux fonctions de traduction, dans le navigateur ou sur le serveur.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Goal
Put user-facing text behind a translation key correctly the first time: in the right file, under the right namespace, and in a way that survives a language switch.
Scope
- Wire locale files into a package that has none yet.
- Add a string to an application or a plugin and render it translated, in the browser or on the server.
- Throw an error that callers see in their own language, and translate mail or jobs for their recipient.
- Add a language to a package that already has locale files.
- Reword a plugin's copy from the application, without editing the plugin.
- Translate a menu or breadcrumb title.
Non-Goals
- Do not build a language picker.
useAppLocale()exists;app-template-defaultalready renders one inclient/layouts/components/language-switcher.tsx. - Do not add i18n machinery to an application. The plugin is registered by default, the client runtime is built by
createAppI18nRuntime, and the server's byI18nProvider. - Do not configure the list of languages. It is whatever the application's own
locales/index.tsdeclares; configuration names only the default,i18n.defaultLocale(overridden byAPP_DEFAULT_LOCALE). The@nocobase/app-plugin-i18nREADME covers that,useAppLocale(), the endpoints, anduseSyncServerLocale(), which the template shell already calls to keep the server's language in step with the browser's.
The one rule that decides everything
A namespace is a package name, and the namespace in scope follows the render tree.
An application's pages get the application's namespace; a plugin's pages get that plugin's, because the host wraps each contribution using the packageName it already records. So a component in its own package's routes translates with no namespace at all.
The exception is what most mistakes come from: a component a plugin exports for the application to render is in the application's scope, not its own. It has to name its namespace.
Procedure
Wiring locales into a package for the first time
A package has a client/locales/ and a server/locales/ tree, each with an en-US.ts, the other languages, and an index.ts mapping every language to a dynamic import:
// client/locales/index.ts, and server/locales/index.ts in the same shape
import type { LocaleLoaders } from '@nocobase/i18n';
const locales: LocaleLoaders = {
'en-US': () => import('./en-US.js'),
'zh-CN': () => import('./zh-CN.js'),
};
export default locales;
Import that module and pass it as locales, the same way on both sides:
// client/plugin.ts
import locales from './locales/index.js';
export default defineClientPlugin({
packageName: '@acme/app-plugin-orders',
locales,
routes,
});
// server/plugin.ts
import locales from './locales/index.js';
export default defineServerPlugin({
baseDir,
packageName: '@acme/app-plugin-orders',
locales,
});
Import it statically. Each language is already a separate dynamic import, so a language is loaded only when something needs it; deferring the map as well gains nothing. locales: () => import('./locales/index.js') is still accepted on both sides for code written that way.
Without this step every t() in the package renders its key. An application's own client/runtime.ts and server/runtime.ts pass their locales the same way.
Adding a string
- Find the package that owns the text. Application text goes in
client/locales/; a plugin's text goes in that plugin'sclient/locales/. - Add the key to
en-US.ts. The structure is written once: the type is derived from the value withLocaleResource<typeof enUS>, and other locales are annotated with it, which is what makes a typo a compile error. - Add the translation to every other locale file. A missing key falls back rather than breaking, so this can lag, and
typecheckreports it. - Render it with
useTranslationfrom@nocobase/i18n/client.
import { useTranslation } from '@nocobase/i18n/client';
const { t } = useTranslation();
t('actions.save');
Keys nest and are addressed with dots: t('trigger.types.schedule').
Naming translation keys
Use short semantic keys that describe the purpose of the text and stay valid when its wording changes. Use lower camelCase within each segment and dots for useful feature or context groups, such as files.uploadFailed or demo.pageDescription. A small namespace may use title directly. Do not use complete English sentences as keys or merely convert a sent
Questions fréquentes
Ajoute-t-elle un sélecteur de langue ?
Non. Le modèle d'application en inclut déjà un, et la skill n'en ajoute pas un autre.
Où sont listées les langues ?
Dans le fichier de locales propre à l'application.
Sur quoi la skill se concentre-t-elle ?
Sur le placement des textes derrière des clés de traduction dans les bons fichiers, pour qu'ils restent corrects lors d'un changement de langue.
Détails
Description originale de l’auteur
Use when adding or changing user-facing text in a NocoBase application or plugin: writing locale files, wiring a package's locales for the first time, translating a component or a menu title, naming a namespace, translating server responses, errors and outbound mail, or adding a language. Not for building page UI around the text (nocobase-app-development) or scaffolding a new plugin (nocobase-app-plugin-development); those Skills hand translation work here.
repo: nocobase/nocobase
Popularité
- Étoiles GitHub
- 25k
- Position au classement
- #10099
- Licence
- —
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
nocobase-app-development
25kAide votre agent à construire les pages, les routes, les données, les permissions et les tests d'une application métier NocoBase 3 complète.
shadcn
25kAide votre agent à trouver, ajouter, corriger et styliser des composants shadcn/ui dans un projet web, en utilisant leur documentation officielle et leurs registres.
nocobase-app-plugin-development
25kAide votre agent à créer et maintenir des extensions NocoBase 3 dans une application existante, y compris les parties serveur, client, base de données et enregistrement.
nocobase-app-upgrade
25kAide votre agent à mettre à niveau une application NocoBase vers une version plus récente du modèle, en intégrant les changements du modèle tout en conservant votre propre travail.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.