File tree Expand file tree Collapse file tree 3 files changed +49
-7
lines changed Expand file tree Collapse file tree 3 files changed +49
-7
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,7 @@ import messages_en from '../translations/en.json';
48
48
import messages_fr from '../translations/fr.json' ;
49
49
import network_modification_locale_en from '../translations/dynamic/network-modifications-locale-en' ;
50
50
import network_modification_locale_fr from '../translations/dynamic/network-modifications-locale-fr' ;
51
- import messages_plugins_en from '../plugins/translations/en.json' ;
52
- import messages_plugins_fr from '../plugins/translations/fr.json' ;
51
+ import messages_plugins from '../plugins/translations' ;
53
52
import aggrid_locale_fr from '../translations/external/aggrid-locale-fr' ;
54
53
import backend_locale_fr from '../translations/external/backend-locale-fr' ;
55
54
import backend_locale_en from '../translations/external/backend-locale-en' ;
@@ -199,7 +198,7 @@ const messages = {
199
198
...element_search_en ,
200
199
...filter_en ,
201
200
...filter_expert_en ,
202
- ...messages_plugins_en , // keep it at the end to allow translation overwritting
201
+ ...messages_plugins . en , // keep it at the end to allow translation overwritting
203
202
} ,
204
203
fr : {
205
204
...messages_fr ,
@@ -219,7 +218,7 @@ const messages = {
219
218
...directory_items_input_fr ,
220
219
...filter_fr ,
221
220
...filter_expert_fr ,
222
- ...messages_plugins_fr , // keep it at the end to allow translation overwritting
221
+ ...messages_plugins . fr , // keep it at the end to allow translation overwritting
223
222
} ,
224
223
} ;
225
224
Original file line number Diff line number Diff line change @@ -45,7 +45,31 @@ const MyPluggableComponent = () => {
45
45
46
46
# How to overwrite translations
47
47
48
- Add your private translations to the following files to complete or overwrite existing translations
48
+ Add your private translations to the following directory to complete or overwrite existing translations
49
49
50
- * src/plugins/translations/en.json
51
- * src/plugins/translations/fr.json
50
+ * src/plugins/translations
51
+
52
+ import your file and export an object messages_plugins for the translation in french or english
53
+ in src/plugins/translations/index.js
54
+
55
+ ``` diff
56
+ import messages_plugins_fr from '../translations/fr.json';
57
+ + import my_plugins_fr from '../translations/my_plugins_fr.json';
58
+
59
+ import messages_plugins_en from '../translations/en.json';
60
+ + import my_plugins_en from '../translations/my_plugins_en.json';
61
+
62
+ const messages_plugins = {
63
+ fr: {
64
+ ...messages_plugins_fr,
65
+ + ...my_plugins_fr,
66
+ },
67
+ en: {
68
+ ...messages_plugins_en,
69
+ + ...my_plugins_en,
70
+ },
71
+ };
72
+
73
+ export default messages_plugins;
74
+
75
+ ```
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2024, RTE (http://www.rte-france.com)
3
+ * This Source Code Form is subject to the terms of the Mozilla Public
4
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+ */
7
+
8
+ import messages_plugins_fr from '../translations/fr.json' ;
9
+ import messages_plugins_en from '../translations/en.json' ;
10
+ const messages_plugins = {
11
+ fr : {
12
+ ...messages_plugins_fr ,
13
+ } ,
14
+ en : {
15
+ ...messages_plugins_en ,
16
+ } ,
17
+ } ;
18
+
19
+ export default messages_plugins ;
You can’t perform that action at this time.
0 commit comments