Skip to content

Commit

Permalink
fix(provider-deepl): add appInfo to DeepL Translator options
Browse files Browse the repository at this point in the history
  • Loading branch information
sargreal committed Sep 27, 2023
1 parent c6e569f commit cbb68bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions providers/deepl/lib/constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict'

const packageJson = require("../package.json")

module.exports = {
DEEPL_FREE_API: 'https://api-free.deepl.com/v2',
DEEPL_PAID_API: 'https://api.deepl.com/v2',
Expand All @@ -12,4 +14,8 @@ module.exports = {
DEEPL_PRIORITY_DIRECT_TRANSLATION: 3,
DEEPL_PRIORITY_USAGE: 1,
DEEPL_PRIORITY_DEFAULT: 5,
DEEPL_APP_INFO: {
appName: packageJson.name,
appVersion: packageJson.version
}
}
2 changes: 2 additions & 0 deletions providers/deepl/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
DEEPL_PRIORITY_DEFAULT,
DEEPL_API_MAX_TEXTS,
DEEPL_API_ROUGH_MAX_REQUEST_SIZE,
DEEPL_APP_INFO
} = require('./constants')
const { parseLocale } = require('./parse-locale')
const { getService } = require('./get-service')
Expand All @@ -33,6 +34,7 @@ module.exports = {

const client = new deepl.Translator(apiKey, {
serverUrl: apiUrl,
appInfo: DEEPL_APP_INFO
})

const limiter = new Bottleneck({
Expand Down

0 comments on commit cbb68bf

Please sign in to comment.