Skip to content

Commit 9e3cc64

Browse files
authored
Fix locale customisation (#645)
* Fix locale customisation Signed-off-by: soupette <cyril@strapi.io> * Fix imports paths Signed-off-by: soupette <cyril@strapi.io>
1 parent 3de4f98 commit 9e3cc64

File tree

1 file changed

+19
-30
lines changed

1 file changed

+19
-30
lines changed

docs/developer-docs/latest/development/admin-customization.md

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = ({ env }) => ({
8181

8282
The `config` object found at `./src/admin/app.js` stores the admin panel configuration.
8383

84-
Any file used by the `config` object (e.g. a custom logo) should be placed in the `./admin/extensions/` folder and imported inside `./src/admin/app.js`.
84+
Any file used by the `config` object (e.g. a custom logo) should be placed in the `./src/admin/extensions/` folder and imported inside `./src/admin/app.js`.
8585

8686
The `config` object accepts the following parameters:
8787

@@ -99,7 +99,7 @@ The `config` object accepts the following parameters:
9999
::: details Example of a custom configuration for the admin panel:
100100

101101
```jsx
102-
// path: ./admin/src/app.js
102+
// path: ./my-app/src/admin/app.js
103103

104104
import AuthLogo from './extensions/my-logo.png';
105105
import MenuLogo from './extensions/logo.png';
@@ -162,22 +162,12 @@ To update the list of available locales in the admin panel, use the `config.loca
162162
```jsx
163163
// path: ./my-app/src/admin/app.js
164164

165-
module.exports = {
166-
// Custom webpack config
167-
webpack: (config, webpack) => {
168-
// Note: we provide webpack above so you should not `require` it
169-
// Perform customizations to webpack config
170-
// Important: return the mutated config
171-
return config;
172-
},
173-
174-
// App customizations
175-
app: config => {
176-
config.locales = ['ru', 'zh'];
177-
178-
return config;
165+
export default {
166+
config: {
167+
locales: ['ru', 'zh']
179168
},
180-
};
169+
bootstrap() {},
170+
}
181171
```
182172

183173
::: note NOTES
@@ -188,30 +178,29 @@ module.exports = {
188178

189179
##### Extending translations
190180

191-
Translation key/value pairs are declared in `./translations/[language-name].json` files. These keys can be extended through the `config.translations` key:
181+
Translation key/value pairs are declared in `@strapi/admin/admin/src/translations/[language-name].json` files. These keys can be extended through the `config.translations` key:
192182

193183
```js
194-
// path: ./src/admin/app.js
184+
// path: ./my-app/src/admin/app.js
195185

196186
export default {
197187
config: {
198188
locales: ['fr'],
199189
translations: {
200190
fr: {
201-
or: 'OR',
202-
'request.error.model.unknown': "This model doesn't exist",
203-
skipToContent: 'Skip to content',
204-
submit: 'Submit',
205-
Totos: 'tata',
206-
"content-type-builder.my-translation-key": "test"
191+
'Auth.form.email.label': 'test',
192+
Users: 'Utilisateurs',
193+
City: 'CITY (FRENCH)',
194+
// Customize the label of the Content Manager table.
195+
Id: 'ID french',
207196
},
208197
},
209198
},
210199
bootstrap() {},
211200
};
212201
```
213202

214-
If more translations files should be added, place them in `/extensions/translations` folder.
203+
If more translations files should be added, place them in `./src/admin/extensions/translations` folder.
215204

216205
#### Logos
217206

@@ -222,13 +211,13 @@ The Strapi admin panel displays a logo in 2 different locations, represented by
222211
| On the login page | `config.auth.logo` |
223212
| In the main navigation | `config.menu.logo` |
224213

225-
To update the logos, put image files in the `./extensions` folder and update the corresponding keys.
214+
To update the logos, put image files in the `./src/admin/extensions` folder and update the corresponding keys.
226215

227216
The size of the custom image should be the same as the default one (434px x 120px).
228217

229218
#### Favicon
230219

231-
To update the favicon, put a favicon file in the `./extensions` folder and update the `config.head.favicon` key in the [admin panel configuration](#configuration-options).
220+
To update the favicon, put a favicon file in the `./src/admin/extensions` folder and update the `config.head.favicon` key in the [admin panel configuration](#configuration-options).
232221

233222
#### Tutorial videos
234223

@@ -299,7 +288,7 @@ module.exports = {
299288

300289
### Webpack configuration
301290

302-
In order to extend the usage of webpack v5, define a function that extends its configuration inside `./admin/webpack.config.js`:
291+
In order to extend the usage of webpack v5, define a function that extends its configuration inside `./my-app/src/admin/webpack.config.js`:
303292

304293
```js
305294
module.exports = {
@@ -316,7 +305,7 @@ module.exports = {
316305
```
317306

318307
::: note
319-
Only `./admin/app.js` and the files under the `./admin/extensions` folder are being watched by the webpack dev server.
308+
Only `./src/admin/app.js` and the files under the `./src/admin/extensions` folder are being watched by the webpack dev server.
320309
:::
321310

322311
## Extension

0 commit comments

Comments
 (0)