Select the menu item File > Save all. Name your new script "Translate
Quickstart" and click OK (The script's name is shown to end users in
several places, including the authorization dialog.)

Try it out

Switch back to your document and reload the page.

After a few seconds, a Translate Quickstart sub-menu will appear under the
Add-ons menu. (If you chose a different name for your script, that name
appears instead.) Click Add-ons > Translate Quickstart > Start.

A dialog box appears and tell you that the script requires authorization.
Click Continue. A second dialog box then requests authorization for
specific Google services. Read the notice carefully, then click Allow.

A sidebar appears. To test it, type some text into your document, then
select it and click the blue Translate button. To replace the text in the
document, click Insert.

Publish

Since this is an example add-on, our tutorial ends here. If you were developing
a real add-on, the last step would be to
publish
it for other people to find and install.

Learn more

To continue learning about how to extend Google Docs with Apps Script, take a
look at the following resources: