johncube / deepl
此包包含调用deepl api以翻译文本的功能。它接受4个参数。key - 您的deepl api密钥。text - 您想要翻译的字符串或字符串数组。target_lang - 您想要翻译成的语言。source_lang(可选)- 源语言。通过d
v1.4
2022-04-21 10:30 UTC
README
此存储库是做什么的?
它使用deepL api来翻译您的文本
如何设置?
composer require johncube/deepl
函数
deepl(key, text, target_language, source_language = null) source_language(可选)- 要翻译的文本的语言。目前可用的选项
"BG" - Bulgarian
"CS" - Czech
"DA" - Danish
"DE" - German
"EL" - Greek
"EN" - English
"ES" - Spanish
"ET" - Estonian
"FI" - Finnish
"FR" - French
"HU" - Hungarian
"IT" - Italian
"JA" - Japanese
"LT" - Lithuanian
"LV" - Latvian
"NL" - Dutch
"PL" - Polish
"PT" - Portuguese (all Portuguese varieties mixed)
"RO" - Romanian
"RU" - Russian
"SK" - Slovak
"SL" - Slovenian
"SV" - Swedish
"ZH" - Chinese
If this parameter is omitted, the API will attempt to detect the language of the text and translate it.
target_lang - 文本应翻译成的语言。目前可用的选项
"BG" - Bulgarian
"CS" - Czech
"DA" - Danish
"DE" - German
"EL" - Greek
"EN-GB" - English (British)
"EN-US" - English (American)
"EN" - English (unspecified variant for backward compatibility; please select EN-GB or EN-US instead)
"ES" - Spanish
"ET" - Estonian
"FI" - Finnish
"FR" - French
"HU" - Hungarian
"IT" - Italian
"JA" - Japanese
"LT" - Lithuanian
"LV" - Latvian
"NL" - Dutch
"PL" - Polish
"PT-PT" - Portuguese (all Portuguese varieties excluding Brazilian Portuguese)
"PT-BR" - Portuguese (Brazilian)
"PT" - Portuguese (unspecified variant for backward compatibility; please select PT-PT or PT-BR instead)
"RO" - Romanian
"RU" - Russian
"SK" - Slovak
"SL" - Slovenian
"SV" - Swedish
"ZH" - Chinese
text - 字符串、字符串数组或包含字符串的对象。
key - 您的deepl api密钥。
用法
require DIR . '/vendor/johncube/deepl/functions.php';
echo deepl('your-api-key', "测试翻译deepl", "EN");