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
Community Support
Community Support

Re: How can I create and use a hash

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.
Don
Regular Visitor

Re: How can I create and use a hash

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
secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,320)