这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 14 additions & 1 deletion workers/loc.api/helpers/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,20 @@ const dateFormat = {
}
const language = {
type: 'string',
enum: ['en', 'ru', 'zh-CN', 'zh-TW', 'es-EM', 'tr', 'pt-PT']
enum: [
'en',
'en-US',
'ru',
'zh-CN',
'zh-TW',
'tr',
'tr-TR',
'es',
'es-EM',
'pt',
'pt-PT',
'pt-BR'
]
}

const paramsSchemaForPayInvoiceList = {
Expand Down
7 changes: 5 additions & 2 deletions workers/loc.api/queue/send-mail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const fs = require('fs')
const pug = require('pug')
const yaml = require('js-yaml')

const LANGUAGES = require('./languages')

const basePathToViews = path.join(__dirname, 'views')
const pathToTrans = path.join(
__dirname,
Expand Down Expand Up @@ -79,7 +81,8 @@ module.exports = (grcBfxReq) => {
presigned_url: url,
language = 'en'
} = { ...data }
const translate = _getTranslator(language)
const normLang = LANGUAGES?.[language] ?? 'en'
const translate = _getTranslator(normLang)
const subject = translate(
configs.subject,
'template.subject'
Expand All @@ -104,7 +107,7 @@ module.exports = (grcBfxReq) => {
text,
subject,
button,
language
language: normLang
}

return grcBfxReq({
Expand Down
16 changes: 16 additions & 0 deletions workers/loc.api/queue/send-mail/languages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict'

module.exports = {
en: 'en',
'en-US': 'en',
ru: 'ru',
'zh-CN': 'zh-CN',
'zh-TW': 'zh-TW',
tr: 'tr',
'tr-TR': 'tr',
es: 'es-EM',
'es-EM': 'es-EM',
pt: 'pt-BR',
'pt-PT': 'pt-BR',
'pt-BR': 'pt-BR'
}
2 changes: 1 addition & 1 deletion workers/loc.api/queue/send-mail/translations/email.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ tr:
download: indir
pgpSignature: bir PGP dijital imza dosyası

pt-PT:
pt-BR:
template:
subject: Seu relatório está pronto
btnText: Baixar CSV
Expand Down