5 Tips when Localizing your Action (adding different languages)

Thinking about making your Action for the Google Assistant available in several languages? Then you’ll want to localize it! Localization helps you reach new audiences by making your Action accessible to audiences that speak different languages. By localizing, you can create and customize experiences for different languages for your Action and your users. Check out all of the Languages & Locales you can localize your Action for and get started.

Need some help along the way? Don’t worry, we’ve got some tips for you. Here are five best practices to help with localizing to reach international audiences:

1. Make sure your Action has advanced and thorough functionality before localizing, including:

  • Robust training phrases — make sure to add more than 15 training phrases per intent to ensure that a diverse and large number of users can access the different functionalities of your Action
  • Broad features and functionality — make sure you’ve built more than just an MVP, and have an Action that’s ready to scale to many users
  • Implement error handling — this means your Action can handle no input, has fallbacks, is ready to help, etc.
  • Provide response variants — this gives your Action a more natural feel and helps translators provide better translations, below are example of response variants for “Anything else” statement:

“Now, what else can I help you with?”

“Is there anything else I can help you with?”

2. Modularize responses out of your code (have a JSON file with your responses). Organizing your code this way it cleans up your code and supports the transition to using an i18n library for localization. Check out this sample code on how it organized itself.

  • Use meaningful variable names for responses to keep things organized. i.e.,
“WELCOME_NEW”: “Welcome to …”,
“WELCOME_BACK”: “Welcome back! I …”,
“REPROMPT_1”: “Sorry, I didn’t hear …”,
“REPROMPT_2”: “Sorry, I still didn’t …”,
“IS_FINAL_REPROMPT”: “I’m sorry I’m …”,
“See you at our next meetup!”,
“Thanks for hanging out, talk to you soon!”


3. For each intent, provide both Text and Speech response options, even if you don’t need it in the native language you originally wrote it in. This will allow for variation in the SSML when needed, without having to change your code every time this is needed. i.e.,

“WELCOME_NEW_TEXT”: “Welcome to …”,
“WELCOME_NEW_SPEECH”: “<speech> Welcome to …”,
“WELCOME_BACK_TEXT”: “Welcome back!…”,
“WELCOME_BACK_SPEECH”: “<speech> Welcome back! …”

4. Use a good client library that supports i18n

// Modules needed for localization
const i18n = require(‘i18n’);
const moment = require(‘moment’);
// Configuration of i18n
directory: path.join(__dirname, ‘/locales’),
objectNotation: true,
fallbacks: {
‘it-IT’: ‘it’,
‘es-MX’: ‘es’,
‘de-DE’: ‘de’,
‘pt-BR’: ‘pt’,
‘ja-JP’: ‘ja’,
app.intent(‘intent name’, async (conv) => {
//do thing
if (something) {
variable = await function(parameters);
app.middleware((conv) => {
conv.localize = () => {


5. Test your Action in the Action Console

  • Have someone listen to the TTS of each language to modify the grammar and use SSML to make the speech more natural sounding. i.e.,
“FALLBACKPROMPT_2_TEXT”: “Sorry, I still didn’t get that. I can tell you about the GDG or when our next event is, or if you’re finished just say ‘goodbye’.”,
“FALLBACKPROMPT_2_SPEECH” : “Sorry, I still didn’t get that. I can tell you about the GDG, or when our next event is. Or, if you’re finished just say ‘goodbye’.”,

Want a step-by-step guide on localizing your Action? Check out Internationalization — Localizing your Action. It’ll walk you through localizing an Action that uses Dialogflow and fulfillment. I hope these tips help you on your journey of localizing your Action for a larger user audience!

Want more? Head over to the Actions on Google community to discuss Actions with other developers. Join the Actions on Google developer community program and you could earn a $200 monthly Google Cloud credit and an Assistant t-shirt when you publish your first app.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s