Fulfillment

Your fulfillment logic can use the locale string it receives in every request to
cater responses to users. This guide shows you how to use some third-party
localization libraries within a Cloud Function for Firebase to return
localized responses.

Localization libraries

Here are some helpful libraries to consider to help you
generate customized responses for specific locales:

General purpose: I18n-node (our
example code snippets use this library)

Create localized responses

This section shows you how to create localized string resource files that
contain localized strings and how to use these resource files in your Cloud
Function for Firebase fulfillment.

To create localized responses:

In the same directory as your package.json and index.js files, create
a locales directory for your localized string files. We'll refer to this
directory as <project-dir>/functions/locales.

Create a resource file that contains localized strings for every locale that
you want to support. For example, if you want to support en-US, en-GB, and
de-DE locales with localized welcome and date messages, those files might look
like this: