At the time of writing this really short post, it is simply not possible to save intents with the same name in apps of different languages in the Snips console. The curious thing is that this error occurs, although the intent does not yet exist in the respective language, but in another one. I can only hope that this is a bug in the console that will be fixed sooner rather than later by the Snips team - and of course in such a way that you can use intents with the same name no matter in what language!

For Snips app developers this seems to require a significant additional effort in maintaining their app with the corresponding implementation in Git repositories. Because for me it would mean that as an app developer you would have to swell the source code of your action to handle the differently named intents in the respective language with the same action code. For example, the Wikipedia (de, en) app I developed would have to have an intent searchWikipedia_DE in the German app and searchWikipedia_EN in the English app. And your intent implementation, i.e. action handler, would have to subscribe to the corresponding intent message for each additional language. Another alternative would be different Git repositories (or at least different branches) for the different languages. That certainly cannot be the right solution in the long term. And since there is the official Music Player app from the Snips team which comes with the identically named intents in the App Store of the individual language, this seems to me to be enough as proof that a different behavior of the console is planned.

So how do I develop apps that are supported by multiple languages?

Of course I also get the above mentioned error in the Snips console. BUT THIS ERROR ONLY APPEARS WHEN THE INTENT IS BEING SAVED FOR THE FIRST TIME. So first I save the intent under a different name - usually I simply number it through - and rename the intent to the desired name afterwards. Yes, that's all. But keep in mind that renaming an intent is only possible as long as the app has not been added to user's assistants. That make sense, doesn't it?

Stoooop! How do I know which language to use to access the Wikipedia API?

But of course I need to know in which language the user is using my app. In the implementation of the action handler I need to know in which language I have to use the Wikipedia API (e.g. language specific API endpoints de.wikipedia.org vs. en.wikipedia.org) or in which language I have to sent status or error messages back to the user via TTS (e.g. Ein Fehler ist aufgetreten vs. An error occured). This information is not that part of the payload in the Hermes protocol. You could try to read the metadata of the installed assistant. Or you could also save that information in a custom configuration. But I decided at an early stage to add a language parameter to my apps.

Both together is a clean programming solution for me. The source code remains clean and you can reuse the intents. The same also applies to slots: slot names and slot types are identical in all languages in my apps.

Lars Martin

I have been developing software for 20 years - mostly on the basis of the JVM. In the recent past I've been doing a methamorphosis towards polyglot projects. In my spare time, I enjoy Smart Home and Home Automation.

Blog Comments powered by Disqus.