Category
Technical
Marketing sub-category
Model
ChatGPT 4
Technical sub-categories
Development
Prompt
Write me a Google apps script that will translate all text in a Google Slides presentation to Korean.
Sample query
Write me a Google apps script that will translate all text in a Google Slides presentation to Korean.
Sample response
Below is a Google Apps Script that translates all text in a Google Slides presentation to Korean:
function translateSlidesToKorean() {
var presentation = SlidesApp.getActivePresentation();
var slides = presentation.getSlides();
var sourceLanguage = 'en'; // Source language (English)
var targetLanguage = 'ko'; // Target language (Korean)
// Loop through each slide in the presentation
slides.forEach(function(slide) {
var shapes = slide.getShapes();
// Loop through each shape in the slide
shapes.forEach(function(shape) {
if (shape.getText() !== '') {
var text = shape.getText();
// Translate text using the Google Translate service
var translatedText = LanguageApp.translate(text, sourceLanguage, targetLanguage);
// Set translated text back to the shape
shape.getText().setText(translatedText);
}
});
});
Logger.log('Translation to Korean completed.');
}
To use this script:
- Open your Google Slides presentation.
- Go to Extensions > Apps Script.
- Delete any code in the script editor and replace it with the provided code.
- Save the script and run the function
translateSlidesToKorean()
. - The script will translate all text in the presentation to Korean.
Please note that you may need to authorize the script to access your Google Slides and Google Translate services when prompted. Additionally, ensure that your Google Slides presentation is not too large, as Google Apps Script has usage limits that may be exceeded for very large presentations.