cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Don
Regular Visitor

How can I create and use a hash

Pretty new to this and finding online documentation wanting.  I built the sample translator app from this tutorial:

https://www.youtube.com/watch?v=-m8UqFp-6Pw

 

One frustrating thing about the translate api is that it can list language names, but the translate methods require translate codes. I though I would improve the app by displaying the language names (more human friendly) in the drop down and use that to look up the language code before calling the translation methods.

 

I tried to do this by trying to creating a collection upon my page becoming visible that allows me to lookup a code from a name. My "onVisible" code is this:

 

If(!loadedonce, ClearCollect(langs, Table({Names:MicrosoftTranslator.Languages().Name, Codes:MicrosoftTranslator.Languages().Code}));UpdateContext({loadedonce: true}))

 

It seems to create the collection but my attempts to use lookup on this are failing. In attempting to debug I thought I would just try to show data from the collection in a text box, but I can't even do that. 

 

My formula for the Text property was "LookUp(langs,Names= ToLanguage.Selected.Value,Codes) " and it is complaining that it is not returning text.

 

Tips or suggestions welcome!

2 REPLIES 2
v-yamao-msft
Community Support
Community Support

Hi Don,

 

Have you seen this documentation about Microsoft Translator:
https://powerapps.microsoft.com/en-us/tutorials/connection-microsoft-translator/
And also this documentation about Lookup function for your reference:
https://powerapps.microsoft.com/en-us/tutorials/function-filter-lookup/

 

Please provide me more information about your scenario for better understanding. I am trying to find out a way to achieve what you want, and my understanding is that you want to translate based on the language names but not on codes, but the translate methods require codes but not names. If I misunderstand you, please feel free correct me.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I read the material and tried to use it (per code samples I included in my original request for help).  Be aware - I am using this as a simple learning assignment. I don't really care about translation per se.

 

So I thought it would be reasonable to try to load language codes and language names to a table, and use lookup to map one to the other.  There is something wrong with my approach becasue lookup fails. I find the documentation inadequate for solving real world problems. I understand how to create a table of ice cream flavors using hard coded records. I am having trouble using the return of a translate method into a table I can subsequently use.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (75,638)