跳到主要内容

v4 code migration: Updating translations

This guide is part of the v4 code migration guide designed to help you migrate the code of a Strapi application from v3.6.x to v4.0.x

🤓 v3/v4 comparison

In Strapi v3, file replacement is supported to customize the frontend of a Strapi application. To modify the translations of an application, original core files can be directly replaced with custom files.

In Strapi v4, file replacement is no longer supported. To extend translations, dedicated extension APIs should be used.

To update translations to Strapi v4:

  1. Rename the ./src/admin/app.example.js to ./src/admin/app.js.
  2. In the config.locales array, add the locales the application should support.
  3. In the config.translations.<your-translation> object, add the missing keys.
Example: Adding translations to Strapi v4
path: ./src/admin/app.js

export default {
config: {
// Add another locale
locales: ['fr'],
translations: {
// Add missing keys in the FR locale
fr: {
'Auth.form.email.label': 'test',
Users: 'Utilisateurs',
City: 'CITY (FRENCH)',
// Customize the label of the Content-Manager table.
Id: 'ID french',
},
},
},
bootstrap() {},
};