[Docs] i18n


#1

In this section, you will learn how to build voice applications that support multiple languages.


This is a companion discussion topic for the original entry at https://www.jovo.tech/docs/output/i18n

#2

The i18n is actually not working for me. I tried out everything. Even with the example template “Travia” the translations do not work. Dear Jovo Team can you please fix this or mention this issue in your docs.


#3

Hi. What kind of error are you getting?


#4

Hi Jan. Unfortunately there is no error message. The text is simply not translated. The final output is the key of the text. Even if i use “this.t()” or “this.$speech.t()” or “this.$speech.addT()”. Or using a SpeechBuilder Instance to create a text. The i18n Json files are in src/i18n/de-DE.json. I checked the docs many times.


#5

Could you paste the incoming request? Is it also in de-DE?


#6

Sure:

{

* "version": "1.0",
* -

"session": {
  * "new": true,
  * "sessionId": "amzn1.echo-api.session.XXXXXXXXXXXXX",
  * -

"application": {
    * "applicationId": "amzn1.echo-sdk-ams.app.XXXXXXXXX"},
  * "attributes": { },
  * -

"user": {
    * "userId": "jovo-debugger-user"}},
* -

"context": {
  * -

"System": {
    * -

"application": {
      * "applicationId": "amzn1.echo-sdk-ams.app.XXXXXXXXXX"},
    * -

"user": {
      * "userId": "jovo-debugger-user"},
    * -

"device": {
      * "deviceId": "amzn1.ask.device.XXXXXXXXXXXXXXXXXXX",
      * -

"supportedInterfaces": {
        * "AudioPlayer": { },
        * -

"Display": {
          * "templateVersion": "1.0",
          * "markupVersion": "1.0"},
        * "VideoApp": { },
        * -

"Alexa.Presentation.APL": {
          * -

"runtime": {
            * "maxVersion": "1.0"}}}}},
  * -

"AudioPlayer": {
    * "offsetInMilliseconds": 0,
    * "playerActivity": "IDLE"}},
* -

"request": {
  * "type": "LaunchRequest",
  * "requestId": "amzn1.echo-api.request.XXXXXXXXXXXX",
  * "timestamp": "2020-02-12T14:44:46.690Z",
  * "locale": "de-DE"}

}

#7

I found a solution for this problem. My Json Files “de-DE.json” are stored in “/src/i18n/”. This seems to be the wrong place. I defined a alternative file path in config.ts. And converted the json files to ts files.

i18n: {
    resources: {
      "de-DE": require("./i18n/de-DE")
    },
    debug: true
  },

Now its working. The docs are little bit confusing at this point.


#8

How to use i18n randomizer with Google Sheets?


#9

Hi @Mistic92, you can create as many rows you want with the same key. Duplicates are turned into arrays by the integration


#10

Hi, when I have added 4 rows with “WELCOME” as key and used this by this.t(“WELCOME”) result was all values separated by comma.


#11

Are you using the SpeechBuilder? The randomized output feature is part of it: https://www.jovo.tech/docs/output/speechbuilder#randomized-output

this.$speech.addT('WELCOME');

this.tell(this.$speech);

#12

Yep, using SpeechBuilder it’s working :slight_smile: Thanks


#13

Hi,

I wanted to put a note which I found useful when I tried to use the i18n in jovo typescript.
To make the i18n default to work , we also need to copy the i18n folder to dist folder.

Though in tsconfig.json, we have enabled resolveJsonModule: true but we also need to include “./src/**/*.json”. Then only when I ran ‘npm run tsc’ it copied the i18n/en-US.json file to dist folder. Hope it would be useful.

“include”: [
“./src//*.json",
"./src/
/",
"./test/**/

],

Thanks
Pai


#14

thanks for sharing the solution