nightscout / cgm-remote-monitor

nightscout web monitor
GNU Affero General Public License v3.0
2.35k stars 71.34k forks source link

Alexa es_ES: Alexa's answer is in English and Spanish #6796

Open fjpezuela opened 3 years ago

fjpezuela commented 3 years ago

If you need support for Nightscout, PLEASE DO NOT FILE A TICKET HERE For support, please post a question to the "CGM in The Cloud" group in Facebook (https://www.facebook.com/groups/cgminthecloud) or visit the WeAreNotWaiting Discord at https://discord.gg/zg7CvCQ

Describe the bug

When using the Alexa template es_ES, the answers are given partly in Spanish and partly in English

To Reproduce

From the amazon developer console you write: "Alexa pregunta a mi monitor que tal lo estoy haciendo"

Expected behavior You should answer with an answer completely in Spanish

Screenshots image

Your setup information

NightScout 14.1.0 Echo Dot

Additional context

The template was translated from the original en_US

fjpezuela commented 3 years ago

@inventor96 I leave you this incident, so you can take a look when you can. Thank you very much for your contributions

fjpezuela commented 3 years ago

It should say something like this: 121 estable hace 4 minutos. Tu basal actual es de 0,5 unidades por hora y no tienes carbohidratos activos.

inventor96 commented 3 years ago

@fjpezuela In your screenshot, there's the two big boxes in the middle with some code in each. Could you copy everything from the box on the left (JSON Input 1) and share it here?

fjpezuela commented 3 years ago

Yes @inventor96, is this:

{ "version": "1.0", "session": { "new": true, "sessionId": "amzn1.echo-api.session.6223bd2f-f082-4dff-8a64-75f18311c93d", "application": { "applicationId": "amzn1.ask.skill.60717763-ef54-43d4-99de-5fd2dbe15cb9" }, "user": { "userId": "xxx" } }, "context": { "Viewports": [ { "type": "APL", "id": "main", "shape": "RECTANGLE", "dpi": 160, "presentationType": "STANDARD", "canRotate": false, "configuration": { "current": { "mode": "HUB", "video": { "codecs": [ "H_264_42", "H_264_41" ] }, "size": { "type": "DISCRETE", "pixelWidth": 1024, "pixelHeight": 600 } } } } ], "Viewport": { "experiences": [ { "arcMinuteWidth": 246, "arcMinuteHeight": 144, "canRotate": false, "canResize": false } ], "mode": "HUB", "shape": "RECTANGLE", "pixelWidth": 1024, "pixelHeight": 600, "dpi": 160, "currentPixelWidth": 1024, "currentPixelHeight": 600, "touch": [ "SINGLE" ], "video": { "codecs": [ "H_264_42", "H_264_41" ] } }, "Extensions": { "available": { "aplext:backstack:10": {} } }, "System": { "application": { "applicationId": "amzn1.ask.skill.60717763-ef54-43d4-99de-5fd2dbe15cb9" }, "user": { "userId": "xxxI" }, "device": { "deviceId": "xxx", "supportedInterfaces": {} }, "apiEndpoint": "https://api.eu.amazonalexa.com", "apiAccessToken": "xxx" } }, "request": { "type": "IntentRequest", "requestId": "xxx", "locale": "es-ES", "timestamp": "2021-01-28T16:20:58Z", "intent": { "name": "NSStatus", "confirmationStatus": "NONE" }, "dialogState": "STARTED" } }

fjpezuela commented 3 years ago

{ "body": { "version": "1.0", "response": { "outputSpeech": { "type": "PlainText", "text": "214 and slightly dropping as of hace unos segundos. Your current basal is 0.4 units per hour and you have 3.19 units of insulin on board." }, "card": { "type": "Simple", "title": "Full Status", "content": "214 and slightly dropping as of hace unos segundos. Your current basal is 0.4 units per hour and you have 3.19 units of insulin on board." }, "reprompt": { "outputSpeech": { "type": "PlainText", "text": "" } }, "shouldEndSession": true, "type": "_DEFAULT_RESPONSE" } } }

sulkaharo commented 3 years ago

This is due to the Spanish localization not being 100% complete. The next release will pretty much fix this fully.

inventor96 commented 3 years ago

Ahh... Makes sense. I think I was looking at the dev branch when I checked the Spanish translations, which would be why I missed it. Thanks @sulkaharo!

@fjpezuela You can either wait for the next Nightscout release, or you can update your repo's dev branch and tell Heroku to use that branch for now.

If you want to go the dev branch route, go to https://github.com/fjpezuela/cgm-remote-monitor/compare/dev...nightscout:dev and follow the normal steps to do a pull request on your repo. Once that's done, go to the "Deploy" tab in Heroku, and scroll down to the bottom to the "Manual Deploy" area, select the "dev" branch, and then click the "Deploy Branch" button (see example below).

image

After that, you should have everything respond in Spanish correctly.

fjpezuela commented 3 years ago

Many thanks for your work. I will wait for the next version. Do you know approximately when it will be available?

fjpezuela commented 3 years ago

Hi,

I have updated my NightScout to version 14.2.0 and I have tried Alexa in Spanish. He continues to speak half in English and half in Spanish. Is there anything else that needs to be done to make it fully work in Spanish?

image

{ "version": "1.0", "session": { "new": true, "sessionId": "amzn1.echo-api.session.f04b500f-2ce6-40d3-b95f-7f0b72bafde1", "application": { "applicationId": "amzn1.ask.skill.60717763-ef54-43d4-99de-5fd2dbe15cb9" }, "user": { "userId": "amzn1.ask.account..." } }, "context": { "Viewports": [ { "type": "APL", "id": "main", "shape": "RECTANGLE", "dpi": 160, "presentationType": "STANDARD", "canRotate": false, "configuration": { "current": { "mode": "HUB", "video": { "codecs": [ "H_264_42", "H_264_41" ] }, "size": { "type": "DISCRETE", "pixelWidth": 1024, "pixelHeight": 600 } } } } ], "Viewport": { "experiences": [ { "arcMinuteWidth": 246, "arcMinuteHeight": 144, "canRotate": false, "canResize": false } ], "mode": "HUB", "shape": "RECTANGLE", "pixelWidth": 1024, "pixelHeight": 600, "dpi": 160, "currentPixelWidth": 1024, "currentPixelHeight": 600, "touch": [ "SINGLE" ], "video": { "codecs": [ "H_264_42", "H_264_41" ] } }, "Extensions": { "available": { "aplext:backstack:10": {} } }, "System": { "application": { "applicationId": "amzn1.ask.skill.60717763-ef54-43d4-99de-5fd2dbe15cb9" }, "user": { "userId": "amzn1.ask.account..." }, "device": { "deviceId": "amzn1.ask.device...", "supportedInterfaces": {} }, "apiEndpoint": "https://api.eu.amazonalexa.com", "apiAccessToken": ".." } }, "request": { "type": "IntentRequest", "requestId": "amzn1.echo-api.request.68feadbd-01b2-4942-88d3-7b1272be8a1b", "locale": "es-ES", "timestamp": "2021-02-16T21:00:13Z", "intent": { "name": "NSStatus", "confirmationStatus": "NONE" }, "dialogState": "STARTED" }

sulkaharo commented 3 years ago

Are you absolutely sure the update went through? Can you see the new version in Nightscout client? The ES language file doesn't have that mix of ES and EN anymore, so it should be impossible to get that response with the release.

fjpezuela commented 3 years ago

Yes, I successfully updated it to version 14.2.0. I already had the code in https://developer.amazon.com/. Will it be necessary to delete it and start over? In the Alexa application I also have Spanish language and in Amazon development as well.

Screenshot_20210217-174053 Screenshot_20210217-174015 Screenshot_20210217-174004

fjpezuela commented 3 years ago

I just upgraded to version 14.2.1 and I have deleted my skill from amazon and created it again. He continues speaking half in Spanish and half in English.

image

inventor96 commented 3 years ago

Wow... That's super confusing...

inventor96 commented 3 years ago

@sulkaharo I'll make a note for myself to create a test skill with alexa in spanish and do some local debugging or something. I'm pretty busy with school right now, but I should be able to take a look at it in the next few months.

fjpezuela commented 3 years ago

Thanks. This is not a priority for me. Thank you very much for your support and for your time.

fjpezuela commented 3 years ago

I'm reviewing the code for NightScout version 14.2.1 and I've seen this in the following file: "cgm-remote-monitor-14.2.1\tests\api.alexa.test.js" There are several "locale": "en-US" in the file. And some of the answers if I ask alexa for "mi monitor" are the ones written there. Is it possible that the problem is there?

image

image

sulkaharo commented 3 years ago

@inventor96 can you extend the unit test to launch intents that trigger the plugins and have it use something other than English? That should reveal what's going on.

@fjpezuela The file you're linking to is a unit test and is not part of the actual implementation of the feature - the code you're looking at simulates Amazon doing a request at the API.

fjpezuela commented 3 years ago

Thanks @sulkaharo . Could you tell me in which file that configuration is to take a look at it?

inventor96 commented 3 years ago

@fjpezuela The main files are the API endpoint (https://github.com/nightscout/cgm-remote-monitor/blob/master/lib/api/alexa/index.js) and the plugin (https://github.com/nightscout/cgm-remote-monitor/blob/master/lib/plugins/alexa.js). There is also some shared code between Alexa and Google (https://github.com/nightscout/cgm-remote-monitor/blob/master/lib/plugins/virtAsstBase.js).

From there, individual plugins provide the information through a virtAsst property. For example, the bgnow plugin has that property, and supplies the "delta" metric for the "MetricNow" intent. (https://github.com/nightscout/cgm-remote-monitor/blob/master/lib/plugins/bgnow.js#L279)

fjpezuela commented 3 years ago

Thanks @inventor96 . I have no idea why it doesn't work. Could it be for some variable in Heroku?

inventor96 commented 3 years ago

@fjpezuela @sulkaharo I found the issue. See #6974.

fjpezuela commented 3 years ago

Thanks @inventor96 . I have deployed NighstScout in the "Dev" branch and I have verified that it works correctly in Spanish.

inventor96 commented 3 years ago

@fjpezuela my branch has not yet been merged with the dev branch (I've still got a bit of work to do on it first), which means that something else fixed your issue. Have you changed the LANGUAGE config variable during any of your troubleshooting since you opened this issue?

fjpezuela commented 3 years ago

Hello @inventor96

Sorry. The other day from heroku I updated my page to the "Dev" branch and tried Alexa and it worked fine in Spanish, but you can see that the NightScout version was updated to 13.0.1. Later I went back to the "master" branch and it was updated to 14.2.2 and I was still speaking in Spanish and English. I followed the steps you indicated above to switch to the "Dev" branch and it was updated to version 14.2.3, but effectively, it still does not work in Spanish.

fjpezuela commented 3 years ago

Hello @inventor96 . What would I have to do to be able to test it?

inventor96 commented 3 years ago

@fjpezuela It would require merging my code into one of your branches, but unfortunately it's not quite ready for testing yet; my changes might have unintended consequences, so I still need to address that.

fjpezuela commented 3 years ago

@inventor96 Agree. No problem. I will wait for it to be officially corrected. Thank you very much for your contributions.

AlessioRosi commented 3 years ago

The same issue for Italian

miguefl commented 4 months ago

I only had to change the LANGUAGE property in Nightscout configuration to Spanish. Something like this:

export LANGUAGE='es'

and it works fine.