Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release version to master #404

Merged
merged 29 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0ccc032
Implement fs multiplication backend for i18next
ZIMkaRU Sep 17, 2024
6e287f2
Implement module to get i18next configured instance
ZIMkaRU Sep 17, 2024
2e555c7
Add simple locales for i18next
ZIMkaRU Sep 17, 2024
a6cbbab
Add initialization flow for i18next into entrypoint
ZIMkaRU Sep 17, 2024
dbcda7a
Add i18next and i18next-fs-backend to prod deps
ZIMkaRU Sep 17, 2024
a5c5217
Add di type for I18next
ZIMkaRU Sep 18, 2024
6a62f39
Add I18next service to di
ZIMkaRU Sep 18, 2024
025bf75
Inject i18next into di
ZIMkaRU Sep 18, 2024
75bf9ae
Improve i18next factory
ZIMkaRU Sep 18, 2024
5693739
Add en translation in json
ZIMkaRU Sep 18, 2024
1e558f5
Add ru translation in json
ZIMkaRU Sep 18, 2024
708859d
Add es translation in json
ZIMkaRU Sep 18, 2024
d98bf82
Add pt translation in json
ZIMkaRU Sep 18, 2024
a01b29c
Add tr translation in json
ZIMkaRU Sep 18, 2024
b111e45
Add zh-cn translation in json
ZIMkaRU Sep 18, 2024
6f8dd41
Add zh-tw translation in json
ZIMkaRU Sep 18, 2024
b6cb2e8
Inject I18next to SendMail service
ZIMkaRU Sep 19, 2024
f96d84c
Rework pug translator to use i18next api
ZIMkaRU Sep 19, 2024
45f3345
Rework SendMail service to use i18next api
ZIMkaRU Sep 19, 2024
e9ef8ea
Add translation namespaces
ZIMkaRU Sep 19, 2024
b488fe1
Use common translation namespaces in i18next service
ZIMkaRU Sep 19, 2024
584ac80
Rework PdfWriter service to use i18next api
ZIMkaRU Sep 19, 2024
7d31910
Remove redundant email translation yaml file
ZIMkaRU Sep 19, 2024
ca3d2f2
Remove redundant pdf translation yaml file
ZIMkaRU Sep 19, 2024
728a069
Remove redundant language file
ZIMkaRU Sep 19, 2024
79f5af0
Remove redundant js-yaml dep
ZIMkaRU Sep 19, 2024
83bffb8
Bump version up to 4.11.0
ZIMkaRU Sep 23, 2024
fa668c0
Merge pull request #402 from ZIMkaRU/feature/add-logic-to-have-separa…
ezewer Sep 23, 2024
ca636b2
Merge pull request #403 from ZIMkaRU/feature/release-version
ezewer Sep 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions locales/en/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"subject": "Your report is ready",
"btnText": "Download Report",
"fileName": "File name",
"unauth": "Your file could not be completed, please try again",
"readyForDownload": "The report you request is ready for download",
"ifDidNotInitAction": "If you did not initiate this action and you suspect that your account may be compromised, please",
"freezeAccount": "freeze your account",
"contactSupport": "and contact support",
"youCan": "You can",
"download": "download",
"pgpSignature": "a PGP digital signature file"
}
}
16 changes: 16 additions & 0 deletions locales/en/pdf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": {
"title": "Report",
"statementDetails": "Statement Details",
"statementDate": "Statement date",
"snapshotAt": "Snapshot at",
"period": "Period",
"username": "Username",
"email": "Email",
"errorMessage": "Your file could not be completed, please try again",
"reportGenAt": "Report generated at",
"copyright": "Copyright © 2013-2024 iFinex Inc. All rights reserved.",
"page": "Page",
"from": "from"
}
}
15 changes: 15 additions & 0 deletions locales/es-EM/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"subject": "Tu reporte esta listo",
"btnText": "Descargar el Informe",
"fileName": "Nombre del archivo",
"unauth": "Tu archivo no se pudo completar, intente de nuevo por favor.",
"readyForDownload": "Tu reporte esta listo para ser descargado",
"ifDidNotInitAction": "Si no realizaste esta acción y sospechas que tu cuenta puede estar comprometida, por favor",
"freezeAccount": "congela tu cuenta",
"contactSupport": "y contacta soporte",
"youCan": "Puedes",
"download": "descargar",
"pgpSignature": "un archivo con firma digital PGP"
}
}
16 changes: 16 additions & 0 deletions locales/es-EM/pdf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": {
"title": "Reporte",
"statementDetails": "Detalles del Estado",
"statementDate": "Fecha del Estado",
"snapshotAt": "Captura al",
"period": "Periodo",
"username": "Nombre de Usuario",
"email": "Correo",
"errorMessage": "Tu archivo no pudo ser completado, por favor inténtalo de nuevo",
"reportGenAt": "Reporte generado al",
"copyright": "Copyright © 2013-2024 iFinex Inc. Todos los derechos reservados.",
"page": "Página",
"from": "de"
}
}
15 changes: 15 additions & 0 deletions locales/pt-BR/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"subject": "Seu relatório está pronto",
"btnText": "Baixar Relatório",
"fileName": "Nome do arquivo",
"unauth": "Não foi possível concluir seu arquivo, tente novamente",
"readyForDownload": "O relatório solicitado está pronto para download",
"ifDidNotInitAction": "Se você não iniciou esta ação e suspeita que sua conta pode estar comprometida",
"freezeAccount": "por favor, congele sua conta",
"contactSupport": "e entre em contato com o suporte",
"youCan": "Você pode",
"download": "baixar",
"pgpSignature": "um arquivo de assinatura digital PGP"
}
}
16 changes: 16 additions & 0 deletions locales/pt-BR/pdf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": {
"title": "Informes",
"statementDetails": "Detalhes da declaração",
"statementDate": "Data da declaração",
"snapshotAt": "Captura de",
"period": "Período",
"username": "Nome de Usuário",
"email": "e-mail",
"errorMessage": "Seu arquivo não pode ser completado, por favor tente novamente",
"reportGenAt": "Informe gerado em ",
"copyright": "Copyright © 2013-2024 iFinex Inc. Todos os direitos reservados.",
"page": "Página",
"from": "de"
}
}
15 changes: 15 additions & 0 deletions locales/ru/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"subject": "Ваш отчет готов",
"btnText": "Скачать Отчет",
"fileName": "Имя файла",
"unauth": "Ваш файл не может быть завершен, пожалуйста, попробуйте еще раз",
"readyForDownload": "Запрашиваемый вами отчет готов к загрузке",
"ifDidNotInitAction": "Если вы не инициировали это действие и подозреваете, что ваша учетная запись может быть взломана, пожалуйста,",
"freezeAccount": "заблокируйте ее",
"contactSupport": "и обратитесь в службу поддержки",
"youCan": "Вы можете",
"download": "скачать",
"pgpSignature": "файл цифровой подписи PGP"
}
}
16 changes: 16 additions & 0 deletions locales/ru/pdf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": {
"title": "Отчет",
"statementDetails": "Детали ведомости",
"statementDate": "Дата ведомости",
"snapshotAt": "Снимок в",
"period": "Период",
"username": "Имя пользователя",
"email": "Эл. почта",
"errorMessage": "Ваш файл не может быть завершен, пожалуйста, попробуйте еще раз",
"reportGenAt": "Отчет сгенерирован в",
"copyright": "Авторское право © 2013-2024 iFinex Inc. Все права защищены.",
"page": "Стр.",
"from": "из"
}
}
15 changes: 15 additions & 0 deletions locales/tr/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"subject": "Raporunuz hazır",
"btnText": "Raporu İndir",
"fileName": "Dosya adı",
"unauth": "Dosyanız tamamlanamadı, lütfen tekrar deneyin",
"readyForDownload": "İstediğiniz rapor indirilmeye hazır",
"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",
"freezeAccount": "hesabınızı dondurun",
"contactSupport": "ve destek ekibiyle iletişime geçin",
"youCan": "Yapabilirsiniz",
"download": "indir",
"pgpSignature": "bir PGP dijital imza dosyası"
}
}
16 changes: 16 additions & 0 deletions locales/tr/pdf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": {
"title": "Rapor",
"statementDetails": "Beyanname Detayları",
"statementDate": "Beyanname Tarihi",
"snapshotAt": "Anlık Görüntü:",
"period": "Dönem",
"username": "Kullanıcı Adı",
"email": "Email",
"errorMessage": "Dosyanız tamamlanamadı, lütfen tekrar deneyin",
"reportGenAt": "Rapor şu tarihte oluşturuldu:",
"copyright": "Telif Hakkı © 2013-2024 iFinex Inc. Tüm hakları saklıdır.",
"page": "Sayfa",
"from": "İtibaren"
}
}
15 changes: 15 additions & 0 deletions locales/zh-CN/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"subject": "您的报告已备妥",
"btnText": "下载报告档案",
"fileName": "档案名称",
"unauth": "档案未下载成功,请重试一次",
"readyForDownload": "您请求的报告已可下载",
"ifDidNotInitAction": "如果您未进行此操作并且怀疑您的帐户已遭盗用,请",
"freezeAccount": "冻结您的帐户",
"contactSupport": "以及联络客服人员",
"youCan": "您可以",
"download": "下载",
"pgpSignature": "PGP数位签名档"
}
}
16 changes: 16 additions & 0 deletions locales/zh-CN/pdf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": {
"title": "报告",
"statementDetails": "结算明细",
"statementDate": "结算日期",
"snapshotAt": "快照时间",
"period": "期间",
"username": "用户名",
"email": "电子邮箱",
"errorMessage": "无法建立档案,请重试",
"reportGenAt": "报告创建时间",
"copyright": "Copyright © 2013-2024 iFinex Inc. All rights reserved.",
"page": "页数",
"from": ""
}
}
15 changes: 15 additions & 0 deletions locales/zh-TW/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"template": {
"subject": "您的報告已備妥",
"btnText": "下載报告檔案",
"fileName": "檔案名稱",
"unauth": "檔案未下載成功,請重試一次",
"readyForDownload": "您請求的報告已可下載",
"ifDidNotInitAction": "如果您未進行此操作並且懷疑您的帳戶已遭盜用,請",
"freezeAccount": "凍結您的帳戶",
"contactSupport": "以及聯絡客服人員",
"youCan": "您可以",
"download": "下載",
"pgpSignature": "PGP數位簽名檔案"
}
}
16 changes: 16 additions & 0 deletions locales/zh-TW/pdf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": {
"title": "報告",
"statementDetails": "結算明細",
"statementDate": "結算日期",
"snapshotAt": "快照時間:",
"period": "期間",
"username": "用戶名",
"email": "電子郵箱",
"errorMessage": "無法建立檔案,請重試",
"reportGenAt": "報告建立時間:",
"copyright": "Copyright © 2013-2024 iFinex Inc. All rights reserved.",
"page": "頁數",
"from": ""
}
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bfx-report",
"version": "4.10.8",
"version": "4.11.0",
"description": "Reporting tool",
"main": "worker.js",
"license": "Apache-2.0",
Expand All @@ -23,8 +23,9 @@
"bitfinex-api-node": "6.0.0",
"colors": "1.4.0",
"csv": "5.5.3",
"i18next": "23.15.1",
"i18next-fs-backend": "2.3.2",
"inversify": "6.0.1",
"js-yaml": "4.1.0",
"lib-js-util-base": "git+https://github.com/bitfinexcom/lib-js-util-base.git",
"lru": "3.1.0",
"moment": "2.29.4",
Expand Down
20 changes: 20 additions & 0 deletions workers/api.service.report.wrk.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const TYPES = require('./loc.api/di/types')
const {
setLoggerDeps
} = require('./loc.api/logger/logger-deps')
const getI18next = require('./loc.api/i18next')
const {
PDFBufferUnderElectronCreationError
} = require('./loc.api/errors')
Expand All @@ -60,6 +61,7 @@ class WrkReportServiceApi extends WrkApi {

this.coreDeps = []
this.appDeps = []
this.transPaths = []

this.loadDIConfig()
this.loadCoreDeps()
Expand All @@ -70,6 +72,11 @@ class WrkReportServiceApi extends WrkApi {
this.start()
}

addTransLocation (transPath) {
const _transPath = transPath ?? path.join(__dirname, '../locales')
this.transPaths.push(_transPath)
}

loadDIConfig (cont = container) {
const conf = this.conf[this.group]

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

async getI18next (i18nextConfigs) {
const i18next = await getI18next({
i18nextConfigs,
transPaths: this.transPaths
})

return i18next
}

getPluginCtx (type) {
const ctx = super.getPluginCtx(type)

Expand Down Expand Up @@ -124,6 +140,7 @@ class WrkReportServiceApi extends WrkApi {

init () {
super.init()
this.addTransLocation()

const dbPathAbsolute = path.isAbsolute(argv.dbFolder)
? argv.dbFolder
Expand Down Expand Up @@ -179,13 +196,16 @@ class WrkReportServiceApi extends WrkApi {
rService.ctx = rService.caller.getCtx()
}

const i18next = await this.getI18next()

this.loadAppDeps({
rService,
processorQueue,
aggregatorQueue,
link: this.grc_bfx.link,
deflateFac: this.deflate_gzip,
grcSlackFac,
i18next,
...deps
})

Expand Down
12 changes: 9 additions & 3 deletions workers/loc.api/di/app.deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,22 @@ module.exports = ({
aggregatorQueue,
deflateFac,
grcSlackFac,
link
link,
i18next
}) => {
return new ContainerModule((bind) => {
bind(TYPES.RService).toConstantValue(rService)
bind(TYPES.RootPath).toConstantValue(rService.ctx.rootPath)
bind(TYPES.I18next).toConstantValue(i18next)
bind(TYPES.RServiceDepsSchema).toConstantValue([
['_responder', TYPES.Responder],
['_getREST', TYPES.GetREST],
['_grcBfxReq', TYPES.GrcBfxReq],
['_prepareApiResponse', TYPES.PrepareApiResponse],
['_generateReportFile', TYPES.GenerateReportFile],
['_hasGrcService', TYPES.HasGrcService],
['_weightedAveragesReport', TYPES.WeightedAveragesReport]
['_weightedAveragesReport', TYPES.WeightedAveragesReport],
['_i18next', TYPES.I18next]
])
bind(TYPES.RServiceDepsSchemaAliase)
.toDynamicValue((ctx) => {
Expand Down Expand Up @@ -164,7 +167,10 @@ module.exports = ({
bind(TYPES.SendMail).toConstantValue(
bindDepsToFn(
sendMail,
[TYPES.GrcBfxReq]
[
TYPES.GrcBfxReq,
TYPES.I18next
]
)
)
bind(TYPES.Processor)
Expand Down
1 change: 1 addition & 0 deletions workers/loc.api/di/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
Container: Symbol.for('Container'),
LoggerFactory: Symbol.for('LoggerFactory'),
Logger: Symbol.for('Logger'),
I18next: Symbol.for('I18next'),
RService: Symbol.for('RService'),
DeflateFac: Symbol.for('DeflateFac'),
GrcSlackFac: Symbol.for('GrcSlackFac'),
Expand Down
Loading