-
Notifications
You must be signed in to change notification settings - Fork 31
GScript Translation GScript翻译
Hakusai Zhang edited this page Jan 29, 2023
·
1 revision
- Create a new project in https://script.google.com // 在Google Script中创建新项目
- Edit default Code.gs files content to following codes and save // 将默认的Code.gs文件内容修改为如下代码并保存
function doGet(e) {
const params = e.parameter
var translatedText = LanguageApp.translate(params.content, params.from, params.to);
const output = ContentService.createTextOutput();
output.setMimeType(ContentService.MimeType.JSON);
output.setContent(JSON.stringify({"result": translatedText}));
return output;
}
- Click Deploy - New Deployment and deploy the code as a web app and anyone can access // 点击 Deploy - New Deployment 并将代码部署为 web app 并且任何人可访问
- Copy Deployment ID to the plugin // 将 Deployment ID 复制到翻译插件
- If you forget your Deployment ID, you can find it on Deploy - Manage Deployment // 如果你忘记了 Deployment ID ,可以从 Deploy - Manage Deployment 中查找