You can create localized Actions with the Actions SDK by creating separate
Action packages for each locale and then uploading them to your Actions project
with the gactions
tool.
To create localized Actions with the Actions SDK:
- Create separate Action packages for each locale that you want to support,
giving them localized names such as
action.de.json
andaction.en.json
. Alternatively, you can create subdirectories in your project for your localized Action packages and other resource files. - Add the
locale
element at the top of your Action package with the language or locale that you want to support. In addition, provide localized query patterns for your Actions, so that users can trigger them properly for the locale they are in. For example:{ "locale": "de", "actions": [ { "intent": { "name": "actions.intent.MAIN", "trigger": { "queryPatterns": [ "<Insert German query patterns here>" ] } } } ] }
- Use the
gactions
tool to upload your Action packages to your Actions project, specifying each of your localized Action packages. For example:./gactions update --project my-project-id --action_package action.de.json --action_package action.en.json --action_package action.fr.json --action_package action.ja.json --action_package action.ko.json