i18n
NocoBase plugins support multi-language internationalization (i18n) for both frontend and backend. You can implement multi-language content in plugins through a unified mechanism.
Multi-language File Management
Plugin multi-language files are uniformly stored in the src/locale directory, named by language, for example:
Each language file exports a JSON object containing all translation entries for that language, for example:
When adding language files for the first time, you need to restart the application for them to take effect. You can verify translation entries through the API: http://localhost:13000/api/app:getLang?locale=zh-CN
Global i18n Instance
app.i18n is the global i18n instance, suitable for CLI or plugin global scenarios. You can combine it with inquirer to implement command-line interactions:
app.i18n.t(text, options)is used to translate text and supports template variables.
Request Context i18n
Each request's ctx.i18n is a clone of the global i18n instance, responding independently with multilingual information based on the client's language.
Set Client Language
- Query String:
- Request Header (Recommended):
Use in Middleware
Accessing http://localhost:13000/api/test-i18n?locale=zh-CN will return 你好.
Plugin Internal i18n
Plugins can directly use plugin.t(key, options) to get translations:
plugin.t(text)is equivalent toctx.t(text, { ns })
Related Links
- Client i18n — Client-side translation files, useT, and tExpr usage
- Language List — Complete list of language codes supported by NocoBase

