How to send an e-mail when language is 100% translated in Localazy using Zapier

Previous articles have already covered what is possible with Zapier integration for Localazy. You can read the introduction to enhancing your localization workflow with Zapier + Localazy or find out how to send a Slack notification to translators when a new comment is added.

Do you want to run some specific actions - such as publish workflow, e-mail notification, files upload, or other - based on the information that certain languages are fully translated? If so, read on!

📌 Introduction

Imagine this example workflow: You're in charge of translating the project for someone else. You have a team of translators working on the project independently. Each translated language is then processed by a local branch of the company you work for - therefore, each e-mail notification should go to a different address, ideally in their language.

I will show you how to do that using the Zapier Integration by Localazy. For the purposes of this workflow, let's say we'd like to track Czech, Polish and Traditional Chinese translations, with English as the project source language.

1️⃣ Add the Trigger

The best way to start is to use the Project published in Localazy Trigger. Therefore search for this trigger and connect the Localazy account. Then you're asked to provide Languages and Files to bundle as a ZIP archive - these are not required. In this workflow, we don't aim to send any files, so we can skip the input.

Trigger: Project published in Localazy setup

The trigger contains output fields with information about the project - such as name and description, data about the organization, and languages. And information about languages is exactly what we need. For each language in the project, there are the following data available:

  • id - internal identifier of the language on Localazy,
  • code - locale code,
  • name - English name of the language/locale,
  • active - number of active keys,
  • review - number of keys waiting for review,
  • current - number of keys with approved version/translation,
  • translated - number of keys that are already translated (but may not be approved yet),
  • sourceChanged - number of keys in the source changed state,
  • needImprovement - number of keys in the "need improvement" state.

Here comes the important part: As I mentioned in the very beginning, we want to notify only if the language(s) are translated to 100%. To process the data, we need to use some special actions Zapier offers. There are a couple of ways to achieve the goal - I'm going to show you one of the most technical ones - we're going to write a piece of code.

2️⃣ Add the Code by Zapier Action

Search for the Code by Zapier Action and select the Run Javascript Event. If you're not really familiar with what it is, there's documentation regarding the action provided by Zapier. Let's set up the action and consider the input data we need.

From the language fields described above, we can conclude that the following formula can be used to calculate whether the Czech language is fully translated.

Is Czech translated on 100% = Number of active keys in source language (EN) > 0 AND Number of active keys in source language (EN) == Number of current keys in Czech language Human-readable formula

Logically, passing other languages instead of Czech would do the work for that language. So now we know what data we need for the input - Project language code, Project language active count, and Project language current count.  Zapier treats array data as a series of strings divided by a comma ",". That's why we need to write a piece of code that extracts the required information for us.

Action: Run Javascript in Code by Zapier setup

First, we split the input data with "," delimiter. Then, we need to get the index of each language code we'd like to operate with (en, cs, pl, zh#Hans in our case).

Then, create the output structure by selecting the number of active keys in the source language and the number of current keys for each tracked language. Because we know the index of each language, we can be sure that the selected number belongs to the same language. The reason why we return -1 fallback is that you wouldn't have to go and edit the Zap every time you delete the processed language in Localazy (you may do that).

Although we could calculate the percentual progress directly in the code (and it would be a completely valid step), I decided to play with the conditions in the Action that follows.

3️⃣ Add Paths by Zapier

Just to summarize, our goal is to send localized e-mails to different addresses. To achieve that, we're going to use Paths by Zapier Action (you can also read how to use Paths by Zapier in How to send a Slack group message for translators using Zapier integration by Localazy).

Let's create three paths (one for each tracked language). The setup is shown in the animation below.

Action: Paths by Zapier setup

As you can see from the conditions, each of the paths would be executed only if:

Number of active keys in source language (EN) > 0 AND Number of active keys in source language (EN) == Number of current keys in Czech language Example for the Czech language

Does that sound familiar? Exactly! This is the formula we defined earlier.

4️⃣ Add Send E-mail Action

The rest of the setup is relatively easy. For each of the paths, add the Send E-mail in Gmail Action. Connect your account and set up the action - the example is in the animation below.

Path Action: Send E-mail in Gmail setup

As you can see, the e-mail body is localized and might be personalized and sent to different addresses.

Let's publish the Zap and test out what we've just created. Go to Localazy and translate all the languages. The publishing process will be triggered. After it finishes (notice the PUBLISHED status in the top right corner), e-mails should arrive quickly.

See the animation below (Chinese mail arrived 5 seconds after I stopped the recording 😅).

This example demonstrates that Zapier Integration by Localazy might be very useful. Using the tools that Zapier provides combined with triggers available in Localazy, you can create personalized workflows that make your work life easier.

⚡ More Zap Templates

You can visit the Localazy Integration page on Zapier to explore more templates.

✔️ Conclusion

Zapier allows you to connect thousands of apps with Localazy and create your own automation workflows without using any code. Learn more in the Zapier integration docs.


This is a companion discussion topic for the original entry at https://localazy.com/blog/how-to-send-email-when-language-is-fully-translated-zapier