@@ -46,6 +46,7 @@ const TYPES = require('./loc.api/di/types')
46
46
const {
47
47
setLoggerDeps
48
48
} = require ( './loc.api/logger/logger-deps' )
49
+ const getI18next = require ( './loc.api/i18next' )
49
50
const {
50
51
PDFBufferUnderElectronCreationError
51
52
} = require ( './loc.api/errors' )
@@ -60,6 +61,7 @@ class WrkReportServiceApi extends WrkApi {
60
61
61
62
this . coreDeps = [ ]
62
63
this . appDeps = [ ]
64
+ this . transPaths = [ ]
63
65
64
66
this . loadDIConfig ( )
65
67
this . loadCoreDeps ( )
@@ -70,6 +72,11 @@ class WrkReportServiceApi extends WrkApi {
70
72
this . start ( )
71
73
}
72
74
75
+ addTransLocation ( transPath ) {
76
+ const _transPath = transPath ?? path . join ( __dirname , '../locales' )
77
+ this . transPaths . push ( _transPath )
78
+ }
79
+
73
80
loadDIConfig ( cont = container ) {
74
81
const conf = this . conf [ this . group ]
75
82
@@ -88,6 +95,15 @@ class WrkReportServiceApi extends WrkApi {
88
95
this . container . load ( ...this . appDeps )
89
96
}
90
97
98
+ async getI18next ( i18nextConfigs ) {
99
+ const i18next = await getI18next ( {
100
+ i18nextConfigs,
101
+ transPaths : this . transPaths
102
+ } )
103
+
104
+ return i18next
105
+ }
106
+
91
107
getPluginCtx ( type ) {
92
108
const ctx = super . getPluginCtx ( type )
93
109
@@ -124,6 +140,7 @@ class WrkReportServiceApi extends WrkApi {
124
140
125
141
init ( ) {
126
142
super . init ( )
143
+ this . addTransLocation ( )
127
144
128
145
const dbPathAbsolute = path . isAbsolute ( argv . dbFolder )
129
146
? argv . dbFolder
@@ -179,13 +196,16 @@ class WrkReportServiceApi extends WrkApi {
179
196
rService . ctx = rService . caller . getCtx ( )
180
197
}
181
198
199
+ const i18next = await this . getI18next ( )
200
+
182
201
this . loadAppDeps ( {
183
202
rService,
184
203
processorQueue,
185
204
aggregatorQueue,
186
205
link : this . grc_bfx . link ,
187
206
deflateFac : this . deflate_gzip ,
188
207
grcSlackFac,
208
+ i18next,
189
209
...deps
190
210
} )
191
211
0 commit comments