Dịch văn bản trong tài liệu trên Google Tài liệu
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Hướng dẫn nhanh này tạo một tiện ích bổ sung cho Trình chỉnh sửa Google Tài liệu giúp dịch văn bản đã chọn trong một tài liệu.
Mục tiêu
Thiết lập tập lệnh.
Chạy tập lệnh.
Điều kiện tiên quyết
Để sử dụng mẫu này, bạn cần đáp ứng các điều kiện tiên quyết sau:
Một Tài khoản Google (tài khoản Google Workspace có thể yêu cầu quản trị viên phê duyệt).
Một trình duyệt web có quyền truy cập vào Internet.
Thiết lập tập lệnh
Tạo một tài liệu trên Google Tài liệu tại docs.new.
Nhấp vào Tiện ích>Apps Script.
Nhấp vào Dự án chưa có tiêu đề.
Đổi tên dự án Apps Script thành Translate Docs (Dịch tài liệu) rồi nhấp vào Rename (Đổi tên).
Bên cạnh tệp Code.gs, hãy nhấp vào biểu tượng Tuỳ chọn khác more_vert>Đổi tên. Đặt tên translate cho tệp.
Nhấp vào Thêm tệp add>HTML. Đặt tên sidebar cho tệp.
Thay thế nội dung của từng tệp bằng đoạn mã tương ứng sau đây, sau đó nhấp vào biểu tượng Lưu .
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2026-05-13 UTC."],[],["This document guides the creation of a Google Docs add-on for text translation. It involves creating a new Google Docs file and an Apps Script project. You will rename files to `translate` and `sidebar`, and replace their content with provided code. The code defines functions for opening a sidebar, selecting text, translating it, and inserting the translated text back into the document. After reloading, accessing the add-on requires selecting text, choosing languages, clicking 'Translate', and finally, clicking 'Insert'.\n"]]