@opentranslate2/baidu-domain
Advanced tools
Comparing version 1.4.4 to 1.4.6
import { Language, Translator, TranslateQueryResult } from "@opentranslate2/translator"; | ||
export declare const domains: string[]; | ||
export type Domain = typeof domains[number]; | ||
export declare type Domain = typeof domains[number]; | ||
export interface BaiduDomainConfig { | ||
@@ -5,0 +5,0 @@ appid: string; |
@@ -16,4 +16,7 @@ "use strict"; | ||
class BaiduDomain extends translator_1.Translator { | ||
name = "baidu-domain"; | ||
endpoint = "https://fanyi-api.baidu.com/api/trans/vip/fieldtranslate"; | ||
constructor() { | ||
super(...arguments); | ||
this.name = "baidu-domain"; | ||
this.endpoint = "https://fanyi-api.baidu.com/api/trans/vip/fieldtranslate"; | ||
} | ||
async query(text, from, to, config) { | ||
@@ -31,3 +34,3 @@ const salt = Date.now(); | ||
domain, | ||
sign: (0, md5_1.default)(appid + text + salt + domain + key) | ||
sign: md5_1.default(appid + text + salt + domain + key) | ||
} | ||
@@ -69,6 +72,2 @@ }).catch(() => { | ||
} | ||
/** Translator lang to custom lang */ | ||
static langMap = new Map(langMap); | ||
/** Custom lang to translator lang */ | ||
static langMapReverse = new Map(langMap.map(([translatorLang, lang]) => [lang, translatorLang])); | ||
getSupportLanguages() { | ||
@@ -86,3 +85,7 @@ return [...BaiduDomain.langMap.keys()]; | ||
exports.BaiduDomain = BaiduDomain; | ||
/** Translator lang to custom lang */ | ||
BaiduDomain.langMap = new Map(langMap); | ||
/** Custom lang to translator lang */ | ||
BaiduDomain.langMapReverse = new Map(langMap.map(([translatorLang, lang]) => [lang, translatorLang])); | ||
exports.default = BaiduDomain; | ||
//# sourceMappingURL=index.js.map |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "1.4.4", | ||
"version": "1.4.6", | ||
"description": "Baidu domain translator with OpenTranslate API.", | ||
@@ -27,4 +27,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@opentranslate2/translator": "^1.4.4" | ||
"@opentranslate2/translator": "^1.4.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16153
295