How to localize a Google Workspace Addon

How to localize a Google Workspace Addon

Google Workspace is a suite of products that are being used by people all around the world. Google products are properly translated and localised for all their users.

While it is fairly simple to translate a Chrome Store item, there is no simple way to translate and localise a Google Workspace Add-on.

At Vocal, our app is used a lot by Spanish people folks, many of which don't speak english. Thus, we had to solve this and make sure our Google Workspace Add-on for Gmail was properly localised for this big chunk of our customers.

Here is how we did it. In our Apps Script editor, we created a new file called Translation.gs. We then created a language map as shown below:

Finally, we wrote a function that would get a user's Locale (the function is provided through the Session class) and return the proper string, based on the input key.

In our code, this would look something like this:

Hope this is useful! We plan on sharing more dev tips as we develop our software :)