Skip to content

Commit ab02a73

Browse files
authored
Merge pull request #404 from bitfinexcom/staging
Release version to master
2 parents 8399316 + ca636b2 commit ab02a73

28 files changed

+464
-326
lines changed

locales/en/email.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"template": {
3+
"subject": "Your report is ready",
4+
"btnText": "Download Report",
5+
"fileName": "File name",
6+
"unauth": "Your file could not be completed, please try again",
7+
"readyForDownload": "The report you request is ready for download",
8+
"ifDidNotInitAction": "If you did not initiate this action and you suspect that your account may be compromised, please",
9+
"freezeAccount": "freeze your account",
10+
"contactSupport": "and contact support",
11+
"youCan": "You can",
12+
"download": "download",
13+
"pgpSignature": "a PGP digital signature file"
14+
}
15+
}

locales/en/pdf.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": {
3+
"title": "Report",
4+
"statementDetails": "Statement Details",
5+
"statementDate": "Statement date",
6+
"snapshotAt": "Snapshot at",
7+
"period": "Period",
8+
"username": "Username",
9+
"email": "Email",
10+
"errorMessage": "Your file could not be completed, please try again",
11+
"reportGenAt": "Report generated at",
12+
"copyright": "Copyright © 2013-2024 iFinex Inc. All rights reserved.",
13+
"page": "Page",
14+
"from": "from"
15+
}
16+
}

locales/es-EM/email.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"template": {
3+
"subject": "Tu reporte esta listo",
4+
"btnText": "Descargar el Informe",
5+
"fileName": "Nombre del archivo",
6+
"unauth": "Tu archivo no se pudo completar, intente de nuevo por favor.",
7+
"readyForDownload": "Tu reporte esta listo para ser descargado",
8+
"ifDidNotInitAction": "Si no realizaste esta acción y sospechas que tu cuenta puede estar comprometida, por favor",
9+
"freezeAccount": "congela tu cuenta",
10+
"contactSupport": "y contacta soporte",
11+
"youCan": "Puedes",
12+
"download": "descargar",
13+
"pgpSignature": "un archivo con firma digital PGP"
14+
}
15+
}

locales/es-EM/pdf.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": {
3+
"title": "Reporte",
4+
"statementDetails": "Detalles del Estado",
5+
"statementDate": "Fecha del Estado",
6+
"snapshotAt": "Captura al",
7+
"period": "Periodo",
8+
"username": "Nombre de Usuario",
9+
"email": "Correo",
10+
"errorMessage": "Tu archivo no pudo ser completado, por favor inténtalo de nuevo",
11+
"reportGenAt": "Reporte generado al",
12+
"copyright": "Copyright © 2013-2024 iFinex Inc. Todos los derechos reservados.",
13+
"page": "Página",
14+
"from": "de"
15+
}
16+
}

locales/pt-BR/email.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"template": {
3+
"subject": "Seu relatório está pronto",
4+
"btnText": "Baixar Relatório",
5+
"fileName": "Nome do arquivo",
6+
"unauth": "Não foi possível concluir seu arquivo, tente novamente",
7+
"readyForDownload": "O relatório solicitado está pronto para download",
8+
"ifDidNotInitAction": "Se você não iniciou esta ação e suspeita que sua conta pode estar comprometida",
9+
"freezeAccount": "por favor, congele sua conta",
10+
"contactSupport": "e entre em contato com o suporte",
11+
"youCan": "Você pode",
12+
"download": "baixar",
13+
"pgpSignature": "um arquivo de assinatura digital PGP"
14+
}
15+
}

locales/pt-BR/pdf.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": {
3+
"title": "Informes",
4+
"statementDetails": "Detalhes da declaração",
5+
"statementDate": "Data da declaração",
6+
"snapshotAt": "Captura de",
7+
"period": "Período",
8+
"username": "Nome de Usuário",
9+
"email": "e-mail",
10+
"errorMessage": "Seu arquivo não pode ser completado, por favor tente novamente",
11+
"reportGenAt": "Informe gerado em ",
12+
"copyright": "Copyright © 2013-2024 iFinex Inc. Todos os direitos reservados.",
13+
"page": "Página",
14+
"from": "de"
15+
}
16+
}

locales/ru/email.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"template": {
3+
"subject": "Ваш отчет готов",
4+
"btnText": "Скачать Отчет",
5+
"fileName": "Имя файла",
6+
"unauth": "Ваш файл не может быть завершен, пожалуйста, попробуйте еще раз",
7+
"readyForDownload": "Запрашиваемый вами отчет готов к загрузке",
8+
"ifDidNotInitAction": "Если вы не инициировали это действие и подозреваете, что ваша учетная запись может быть взломана, пожалуйста,",
9+
"freezeAccount": "заблокируйте ее",
10+
"contactSupport": "и обратитесь в службу поддержки",
11+
"youCan": "Вы можете",
12+
"download": "скачать",
13+
"pgpSignature": "файл цифровой подписи PGP"
14+
}
15+
}

locales/ru/pdf.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": {
3+
"title": "Отчет",
4+
"statementDetails": "Детали ведомости",
5+
"statementDate": "Дата ведомости",
6+
"snapshotAt": "Снимок в",
7+
"period": "Период",
8+
"username": "Имя пользователя",
9+
"email": "Эл. почта",
10+
"errorMessage": "Ваш файл не может быть завершен, пожалуйста, попробуйте еще раз",
11+
"reportGenAt": "Отчет сгенерирован в",
12+
"copyright": "Авторское право © 2013-2024 iFinex Inc. Все права защищены.",
13+
"page": "Стр.",
14+
"from": "из"
15+
}
16+
}

locales/tr/email.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"template": {
3+
"subject": "Raporunuz hazır",
4+
"btnText": "Raporu İndir",
5+
"fileName": "Dosya adı",
6+
"unauth": "Dosyanız tamamlanamadı, lütfen tekrar deneyin",
7+
"readyForDownload": "İstediğiniz rapor indirilmeye hazır",
8+
"ifDidNotInitAction": "Bu işlemi siz başlatmadıysanız ve hesabınızın güvenliğinin ihlal edilmiş olabileceğinden şüpheleniyorsanız, lütfen",
9+
"freezeAccount": "hesabınızı dondurun",
10+
"contactSupport": "ve destek ekibiyle iletişime geçin",
11+
"youCan": "Yapabilirsiniz",
12+
"download": "indir",
13+
"pgpSignature": "bir PGP dijital imza dosyası"
14+
}
15+
}

locales/tr/pdf.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": {
3+
"title": "Rapor",
4+
"statementDetails": "Beyanname Detayları",
5+
"statementDate": "Beyanname Tarihi",
6+
"snapshotAt": "Anlık Görüntü:",
7+
"period": "Dönem",
8+
"username": "Kullanıcı Adı",
9+
"email": "Email",
10+
"errorMessage": "Dosyanız tamamlanamadı, lütfen tekrar deneyin",
11+
"reportGenAt": "Rapor şu tarihte oluşturuldu:",
12+
"copyright": "Telif Hakkı © 2013-2024 iFinex Inc. Tüm hakları saklıdır.",
13+
"page": "Sayfa",
14+
"from": "İtibaren"
15+
}
16+
}

locales/zh-CN/email.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"template": {
3+
"subject": "您的报告已备妥",
4+
"btnText": "下载报告档案",
5+
"fileName": "档案名称",
6+
"unauth": "档案未下载成功,请重试一次",
7+
"readyForDownload": "您请求的报告已可下载",
8+
"ifDidNotInitAction": "如果您未进行此操作并且怀疑您的帐户已遭盗用,请",
9+
"freezeAccount": "冻结您的帐户",
10+
"contactSupport": "以及联络客服人员",
11+
"youCan": "您可以",
12+
"download": "下载",
13+
"pgpSignature": "PGP数位签名档"
14+
}
15+
}

locales/zh-CN/pdf.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": {
3+
"title": "报告",
4+
"statementDetails": "结算明细",
5+
"statementDate": "结算日期",
6+
"snapshotAt": "快照时间",
7+
"period": "期间",
8+
"username": "用户名",
9+
"email": "电子邮箱",
10+
"errorMessage": "无法建立档案,请重试",
11+
"reportGenAt": "报告创建时间",
12+
"copyright": "Copyright © 2013-2024 iFinex Inc. All rights reserved.",
13+
"page": "页数",
14+
"from": ""
15+
}
16+
}

locales/zh-TW/email.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"template": {
3+
"subject": "您的報告已備妥",
4+
"btnText": "下載报告檔案",
5+
"fileName": "檔案名稱",
6+
"unauth": "檔案未下載成功,請重試一次",
7+
"readyForDownload": "您請求的報告已可下載",
8+
"ifDidNotInitAction": "如果您未進行此操作並且懷疑您的帳戶已遭盜用,請",
9+
"freezeAccount": "凍結您的帳戶",
10+
"contactSupport": "以及聯絡客服人員",
11+
"youCan": "您可以",
12+
"download": "下載",
13+
"pgpSignature": "PGP數位簽名檔案"
14+
}
15+
}

locales/zh-TW/pdf.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"template": {
3+
"title": "報告",
4+
"statementDetails": "結算明細",
5+
"statementDate": "結算日期",
6+
"snapshotAt": "快照時間:",
7+
"period": "期間",
8+
"username": "用戶名",
9+
"email": "電子郵箱",
10+
"errorMessage": "無法建立檔案,請重試",
11+
"reportGenAt": "報告建立時間:",
12+
"copyright": "Copyright © 2013-2024 iFinex Inc. All rights reserved.",
13+
"page": "頁數",
14+
"from": ""
15+
}
16+
}

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bfx-report",
3-
"version": "4.10.8",
3+
"version": "4.11.0",
44
"description": "Reporting tool",
55
"main": "worker.js",
66
"license": "Apache-2.0",
@@ -23,8 +23,9 @@
2323
"bitfinex-api-node": "6.0.0",
2424
"colors": "1.4.0",
2525
"csv": "5.5.3",
26+
"i18next": "23.15.1",
27+
"i18next-fs-backend": "2.3.2",
2628
"inversify": "6.0.1",
27-
"js-yaml": "4.1.0",
2829
"lib-js-util-base": "git+https://github.com/bitfinexcom/lib-js-util-base.git",
2930
"lru": "3.1.0",
3031
"moment": "2.29.4",

workers/api.service.report.wrk.js

+20
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const TYPES = require('./loc.api/di/types')
4646
const {
4747
setLoggerDeps
4848
} = require('./loc.api/logger/logger-deps')
49+
const getI18next = require('./loc.api/i18next')
4950
const {
5051
PDFBufferUnderElectronCreationError
5152
} = require('./loc.api/errors')
@@ -60,6 +61,7 @@ class WrkReportServiceApi extends WrkApi {
6061

6162
this.coreDeps = []
6263
this.appDeps = []
64+
this.transPaths = []
6365

6466
this.loadDIConfig()
6567
this.loadCoreDeps()
@@ -70,6 +72,11 @@ class WrkReportServiceApi extends WrkApi {
7072
this.start()
7173
}
7274

75+
addTransLocation (transPath) {
76+
const _transPath = transPath ?? path.join(__dirname, '../locales')
77+
this.transPaths.push(_transPath)
78+
}
79+
7380
loadDIConfig (cont = container) {
7481
const conf = this.conf[this.group]
7582

@@ -88,6 +95,15 @@ class WrkReportServiceApi extends WrkApi {
8895
this.container.load(...this.appDeps)
8996
}
9097

98+
async getI18next (i18nextConfigs) {
99+
const i18next = await getI18next({
100+
i18nextConfigs,
101+
transPaths: this.transPaths
102+
})
103+
104+
return i18next
105+
}
106+
91107
getPluginCtx (type) {
92108
const ctx = super.getPluginCtx(type)
93109

@@ -124,6 +140,7 @@ class WrkReportServiceApi extends WrkApi {
124140

125141
init () {
126142
super.init()
143+
this.addTransLocation()
127144

128145
const dbPathAbsolute = path.isAbsolute(argv.dbFolder)
129146
? argv.dbFolder
@@ -179,13 +196,16 @@ class WrkReportServiceApi extends WrkApi {
179196
rService.ctx = rService.caller.getCtx()
180197
}
181198

199+
const i18next = await this.getI18next()
200+
182201
this.loadAppDeps({
183202
rService,
184203
processorQueue,
185204
aggregatorQueue,
186205
link: this.grc_bfx.link,
187206
deflateFac: this.deflate_gzip,
188207
grcSlackFac,
208+
i18next,
189209
...deps
190210
})
191211

workers/loc.api/di/app.deps.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,22 @@ module.exports = ({
4040
aggregatorQueue,
4141
deflateFac,
4242
grcSlackFac,
43-
link
43+
link,
44+
i18next
4445
}) => {
4546
return new ContainerModule((bind) => {
4647
bind(TYPES.RService).toConstantValue(rService)
4748
bind(TYPES.RootPath).toConstantValue(rService.ctx.rootPath)
49+
bind(TYPES.I18next).toConstantValue(i18next)
4850
bind(TYPES.RServiceDepsSchema).toConstantValue([
4951
['_responder', TYPES.Responder],
5052
['_getREST', TYPES.GetREST],
5153
['_grcBfxReq', TYPES.GrcBfxReq],
5254
['_prepareApiResponse', TYPES.PrepareApiResponse],
5355
['_generateReportFile', TYPES.GenerateReportFile],
5456
['_hasGrcService', TYPES.HasGrcService],
55-
['_weightedAveragesReport', TYPES.WeightedAveragesReport]
57+
['_weightedAveragesReport', TYPES.WeightedAveragesReport],
58+
['_i18next', TYPES.I18next]
5659
])
5760
bind(TYPES.RServiceDepsSchemaAliase)
5861
.toDynamicValue((ctx) => {
@@ -164,7 +167,10 @@ module.exports = ({
164167
bind(TYPES.SendMail).toConstantValue(
165168
bindDepsToFn(
166169
sendMail,
167-
[TYPES.GrcBfxReq]
170+
[
171+
TYPES.GrcBfxReq,
172+
TYPES.I18next
173+
]
168174
)
169175
)
170176
bind(TYPES.Processor)

workers/loc.api/di/types.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
Container: Symbol.for('Container'),
99
LoggerFactory: Symbol.for('LoggerFactory'),
1010
Logger: Symbol.for('Logger'),
11+
I18next: Symbol.for('I18next'),
1112
RService: Symbol.for('RService'),
1213
DeflateFac: Symbol.for('DeflateFac'),
1314
GrcSlackFac: Symbol.for('GrcSlackFac'),

0 commit comments

Comments
 (0)