Google Docs Editor के ऐड-ऑन का इस्तेमाल शुरू करना
इस शुरुआती निर्देश से, Google Docs Editor का एक ऐड-ऑन बनता है. यह ऐड-ऑन, दस्तावेज़ में चुने गए टेक्स्ट का अनुवाद करता है.
मकसद
- स्क्रिप्ट सेट अप करें.
- स्क्रिप्ट चलाएं.
ज़रूरी शर्तें
इस सैंपल का इस्तेमाल करने के लिए, आपको ये ज़रूरी शर्तें पूरी करनी होंगी:
- Google खाता (Google Workspace खातों के लिए, एडमिन की अनुमति की ज़रूरत पड़ सकती है).
- इंटरनेट का ऐक्सेस वाला वेब ब्राउज़र.
स्क्रिप्ट सेट अप करना
- docs.new पर जाकर, Google Docs दस्तावेज़ बनाएं.
- एक्सटेंशन > Apps Script पर क्लिक करें.
- बिना टाइटल वाला प्रोजेक्ट पर क्लिक करें.
- Apps Script प्रोजेक्ट का नाम बदलकर Translate Docs करें और नाम बदलें पर क्लिक करें.
Code.gs
फ़ाइल के बगल में, ज़्यादा more_vert
> नाम बदलें पर क्लिक करें. फ़ाइल को translate
नाम दें.
- फ़ाइल जोड़ें add
> एचटीएमएल पर क्लिक करें. फ़ाइल को
sidebar
नाम दें.
हर फ़ाइल के कॉन्टेंट को, नीचे दिए गए कोड से बदलें. इसके बाद,
सेव करें
पर क्लिक करें.
स्क्रिप्ट चलाना
- अपने Docs दस्तावेज़ में, पेज को फिर से लोड करें.
- एक्सटेंशन >
Docs का अनुवाद करें
> शुरू करें पर क्लिक करें.
- जब कहा जाए, तब ऐड-ऑन को अनुमति दें.
अनुमति मिलने के बाद, ऐड-ऑन फिर से शुरू हो जाएगा.
- अपने दस्तावेज़ में कुछ टेक्स्ट टाइप करें और उसे चुनें.
- ऐड-ऑन में, अनुवाद करें पर क्लिक करें. दस्तावेज़ में टेक्स्ट बदलने के लिए, शामिल करें पर क्लिक करें.
अगले चरण
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-02-14 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-02-14 (UTC) को अपडेट किया गया."],[[["This quickstart guide demonstrates how to build a Google Docs add-on using Apps Script that translates selected text within a document."],["The add-on allows users to select text, choose source and target languages, and obtain the translation, with an option to insert the translated text directly into the document."],["Users need a Google Account and a web browser to utilize this add-on, which involves setting up a script, running it, and authorizing permissions."],["The add-on provides a user interface within a sidebar in Google Docs for easy interaction and language selection."],["Further resources are available for extending Google Docs functionality with Apps Script and exploring the Document service for more advanced customizations."]]],["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"]]