0

we are trying to add multi-language support to our google home application. We need to support: English(us), En(CA), French(CA).

For that we specify lang property in the sync response including locale like en-us, en-ca, fr-ca: Note: synonyms for EN-US and EN-CA may be different.

   "requestId":,
   "payload":{
      "agentUserId":"xxx",
      "devices":[
         {
            "id":"xxx",
            "type":"xxx",
            "traits":[
               "action.devices.traits.Cook",
               "action.devices.traits.OnOff"
            ],
            "name":{
               "defaultNames":[
                  "xxx"
               ],
               "name":"xxx",
               "nicknames":[
                  "xxxx"
               ]
            },
            "willReportState":true,
            "attributes":{
               "supportedCookingModes":[
                  "BREW",
                  "BOIL"
               ],
               "foodPresets":[
                  ...,
                  {
                     "food_preset_name":"water",
                     "supported_units":[
                        "CUPS",
                        "OUNCES",
                        "NO_UNITS"
                     ],
                     "food_synonyms":[
                        {
                           "synonym":[
                              "hot water",
                              "water",
                           ],
                           "lang":"en-us"
                        },
                        {
                           "synonym":[
                              "hot water",
                              "water",
                           ],
                           "lang":"en-ca"
                        },
                        {
                           "synonym":[
                              "eau chaude",
                              "eau",
                           ],
                           "lang":"fr-ca"
                        }
                     ]
                  }
               ]
            },
            "deviceInfo":{
               "manufacturer":"xxx",
               "model":"xxx",
               "hwVersion":"1.0",
               "swVersion":"1.0"
            }
         }
      ]
   }
}

With such settings 50% of phrases do not work.

It worked with lang: "en" when we had English language only. But after adding of additional languages it stopped working.

As well here is selected languages: choose languages

What we are missing?

  • Does it work if you stick with the language only and not locale, ie. `en` and `fr`, as noted [in the docs](https://developers.google.com/assistant/smarthome/traits/cook#device-attributes)? – Nick Felker Jul 29 '21 at 16:54
  • @NickFelker yes, if we use only `en` or `fr` it works – Mihail Martinovich Aug 02 '21 at 12:45
  • @NickFelker But we need a locale because we have Eng for Canada Eng for US and French for Canada, what should we do in such case? – Mihail Martinovich Aug 03 '21 at 09:41
  • 1
    I think your SYNC response should just have the language code, which for `en` would include all relevant `en` synonyms. – Nick Felker Aug 16 '21 at 17:30
  • Hi @NickFelker We have separate lists of phrases for every language locale. You suggest to use just **en** or **fr** in Sync response, so what should we do with our lists of phrases, should we combine them into one list for every supported language? – Mihail Martinovich Aug 19 '21 at 14:11
  • 2
    You should merge the lists such that they are per-language – Nick Felker Aug 19 '21 at 17:59

1 Answers1

0

The kind of notation that you seem to be using for the lang as part of the sync response is BCP-47 notation. These tags are typically of the form language-region, where language refers to the primary language and region refers to the region (usually a country identifier) of the particular dialect. For example, English may either be represented by American English (en-US), or British English (en-GB). A complete comprehensive list of the languages supported by Google Assistant Service can be found here : https://developers.google.com/assistant/sdk/reference/rpc/languages?hl=en

Now when it comes to Smart Home, instead of providing a language-region pair you should just provide a language. Assistant for Smart Home will handle all different regions for that primary language. These changes can be made to the sync response for the Cook trait to get it fully working: Change the “en - us” and “en - ca” as part of the lang in the food_synonym attribute to just “en”. Change the “fr - ca” as part of the lang in the food_synonym attribute to just “fr”. List all the synonyms for different regions under these languages.

More information about the list of languages currently supported Smart Home (Cook and OnOff traits) can be found here : https://developers.google.com/assistant/smarthome/traits#supported-languages