How to translate Strapi v4 Admin Panel
— Strapi — 1 min read
To translate Strapi's V4 admin panel frontend first make sure you are running Strapi server using:
strapi develop --watch-admin
command or else you'll need to run strapi build
for every change.
I spent a good 30min until I found out this.
So, go to the file src/admin/app.js
and add the translates that you need:
1export default {2 config: {3 // others configs4 locales: [5 "pt-BR",6 "fr"7 ],8 },9};
But note that is not possible to remove the English en
translation because is the Strapi Admin Panel fallback language.
Overwriting
To overwrite any existing translation add a translations
key inside the config
object with the translation key/value of the language. You can see all Strapi default translations here or inside your project's node_modules @strapi/admin/admin/src/translations/[language-name].json
.
Here is an example to translate the Strapi navbar title and subtitle:
1export default {2 config: {3 // others configs4 locales: [5 "pt-BR",6 "fr"7 ],8 translations: {9 "pt-BR": {10 "app.components.LeftMenu.navbrand.title": "Painel Admin",11 "app.components.LeftMenu.navbrand.workplace": "mywebsite.com",12 },13 fr: {14 "app.components.LeftMenu.navbrand.title": "Panneau d'administration",15 "app.components.LeftMenu.navbrand.workplace": "mywebsite.com",16 },17 },18 },19};
Result
After following the previous steps you will see language select at your profile page /admin/me
and the login page.
Language select at Login page:
Language select at Profile page: