Skip to content

GScript Translation GScript翻译

Hakusai Zhang edited this page Jan 29, 2023 · 1 revision
  1. Create a new project in https://script.google.com // 在Google Script中创建新项目

image

  1. 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;
}

image

  1. Click Deploy - New Deployment and deploy the code as a web app and anyone can access // 点击 Deploy - New Deployment 并将代码部署为 web app 并且任何人可访问

image

  1. Copy Deployment ID to the plugin // 将 Deployment ID 复制到翻译插件

image

  1. If you forget your Deployment ID, you can find it on Deploy - Manage Deployment // 如果你忘记了 Deployment ID ,可以从 Deploy - Manage Deployment 中查找
Clone this wiki locally