SDK 安装
npm install @alicloud/pop-core -S
Code Sample
const Core = require('@alicloud/pop-core');
var client = new Core({
accessKeyId: 'LTAIOZZg********',
accessKeySecret: 'v7CjUJCMk7j9aKduMA************',
endpoint: 'https://mt.cn-hangzhou.aliyuncs.com',
apiVersion: '2018-10-12'
});
var params = {
"RegionId": "cn-hangzhou",
"FormatType": "text",
"SourceLanguage": "zh",
"TargetLanguage": "en",
"SourceText": "北京欢迎你"
}
var requestOption = {
method: 'POST'
};
client.request('TranslateGeneral', params, requestOption).then((result) => {
console.log(JSON.stringify(result));
}, (ex) => {
console.log(ex);
})
The Result
参考链接
机器翻译通用版调用指南 阿里云常见参数获取位置