apps-script-samples icon indicating copy to clipboard operation
apps-script-samples copied to clipboard

feat(slides): add enhanced translation with source language selection and translate-all functionality

Open happygoluckycodeeditor opened this issue 2 months ago • 5 comments

Description

This contribution adds an enhanced translation feature for Google Slides that allows users to translate entire presentations with full control over source and target languages. Helps in quick translation of all slides. The code is based on the already existing sample app.

Use-case: Usually used in office scenarios to translate lots of slides and its elements quickly in one-go.

New files added:

  • translateAllSlides.gs - Enhanced version with translateAllSlides() function to translate all slides at once
  • sidebarEnhanced.html - Improved UI with source language selection and expanded language support

Key improvements:

  • Added translateAllSlides() function to translate entire presentations in one click
  • Expanded language support from 9 to 30+ languages
  • Added source language selection with auto-detect option
  • Two translation modes: translate selected elements or all slides
  • Original translate.gs and sidebar.html remain unchanged (used in official documentation)

Fixes # (N/A - this is a new feature addition)

Is it been tested?

  • [x] Development testing done

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have performed a peer-reviewed with team member(s)
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] Any dependent changes have been merged and published in downstream modules

happygoluckycodeeditor avatar Nov 27 '25 11:11 happygoluckycodeeditor

Summary of Changes

Hello @happygoluckycodeeditor, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the Google Slides translation add-on by introducing an "enhanced" version. The primary goal is to facilitate quick and comprehensive translation of entire presentations, particularly useful in professional settings. It achieves this by offering a new sidebar interface that allows users to select both source and target languages (with an auto-detect option for source) and provides the choice to translate either selected elements or all text content across all slides, supporting a much broader range of languages.

Highlights

  • Enhanced Translation Functionality: Introduces the ability to translate entire Google Slides presentations with a single click.
  • Source Language Selection: Adds an option for users to explicitly select the source language or utilize an auto-detect feature.
  • Expanded Language Support: Increases the number of supported translation languages from 9 to over 30.
  • Dual Translation Modes: Provides two distinct modes: translating only selected elements or translating all text across all slides.
  • New Files: Adds translateAllSlides.gs for backend logic and sidebarEnhanced.html for the new user interface.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Nov 27 '25 11:11 gemini-code-assist[bot]

Working on the feedback! Thank you very much! Be right back! :D

happygoluckycodeeditor avatar Nov 27 '25 11:11 happygoluckycodeeditor

@gemini-code-assist I have added/made the necessary changes. Can you have a look?

Also removed the Auto-detect thing because it does not serve much purpose when the person doing the translate already knows the content of the slide and is just trying to change it to another language.

happygoluckycodeeditor avatar Nov 27 '25 11:11 happygoluckycodeeditor

Thanks for the feedback. I am not sure if all of the suggestions are worth it. I ran the script on a 50 page Japanese Presentation with lots of text and the script did not time-out or went over the quota or give that sort of an error :D

  • I added a function which ignores images (it was throwing errors if the shapes were images). The code is now properly updated. Hope that will be it!

P.S. Tested and reviewed by peers as well

image

happygoluckycodeeditor avatar Nov 27 '25 11:11 happygoluckycodeeditor

@jpoehnelt Hello!
I made a small contribution and would love your feedback whenever you have time.
Totally understand if you're busy — thanks in advance~

happygoluckycodeeditor avatar Dec 02 '25 05:12 happygoluckycodeeditor