cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
empanado
New Member

Change the text of a button inside a Canvas App

Hi everybody.

 

We are developing some improvements in a Canvas App. One of the features is the ability to translate on the fly some texts.

Our app gets the data from SharePoint lists, and we have fields for English and Français texts. The app also has an Excel with the translations of almost every control in the app. So if the user changes the browser's language, the app translates the texts automatically.

 

What our development does is, if the user changes the language, the app shows the English or Français texts from the SP lists. This works fine.

 

The thing is that we have a button and an HTML Text controls in a gallery, inside a component. The HTML Text shows some info and the button has the text "Read more". The HTML Text works fine translating the text to English or Français. But the button has a strange behaviour:

 

We set the button text depending on the value from a custom property.

empanado_2-1615373829271.png

 

We have created the custom property DisplayLanguage in the component, setting "en-US" as default value.

empanado_1-1615373704203.png

 

In the screen, we set the custom property DisplayLanguage to the global variable varLanguage. As you can see, is set to "fr-FR", which overrides the default value in the component. The text in the white box is translated to Français using the DisplayLanguage value. The button shows "Lire plus" for a second or two, and then the text changes automatically to "Read more" (as seen in the image below).

empanado_3-1615374267615.png

 

We think that the gallery reads all the items given, and some reset is done to the DisplayLanguage custom property.

The gallery Items property has a SortByColumns function, which we have modified to fit in our development. The OOB code is inside the red box below:

empanado_5-1615375528623.png

 

Questions:

1. Does anybody knows what could be going on?

2. How the SortByColumns function modifies the scope of the component?

3. Have anybody got any approach to solve this issue?

 

Thank you in advance.

Kind regards.

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Community Support
Community Support

Hi @empanado ,

Based on your description, I did a test on my side(using all settings you mentioned), and reproduce your issue.

I agree with your suspicions that “the gallery reads all the items given, and some reset is done to the DisplayLanguage custom property”.  Per my test, I think this is more related to the condition in the gallery Items property. I have tried many ways but still cannot find a solution or a good explanation.

You can see my test results:

When using below formula of the gallery, when run my app, the function on button and HMTL text controls both don’t work(still keep in “en-US” format), but the SortByColumns and Search functions inside Gallery Items property do work:

v-albai-msft_0-1615542922631.png

I am not sure if below formula can work but you can have a try. Since when using a simple table as data source, everything works well. On my side:

SortByColumns(Filter(NewsGallery.Items,If(NewsGallery.DisplayLanguage="en-US",TextInput1.Text in Title, NewsGallery.DisplayLanguage="fr-FR", TextInput1.Text in TitreFR)),"Created",Descending)

On your side, the code should be:

SortByColumns(Filter(colCompanyNews,If(NewsGallery.DisplayLanguage="en-US",txtSearchNews.Text in Title || txtSearchNews.Text in Blurb || txtSearchNews.Text in Details, NewsGallery.DisplayLanguage="fr-FR", txtSearchNews.Text in TitreFR || txtSearchNews.Text in PresentationFR || txtSearchNews.Text in DetailsFR)),"Created",Descending)

v-albai-msft_1-1615542922637.png

If above still cannot work, I think this would be better handled in a support case at: https://powerapps.microsoft.com/en-us/support/pro. The support engineers there have more experiences and more resources, also they can remote to help you dig deeper into your issue.

Best Regards,

Allen

View solution in original post

1 REPLY 1
v-albai-msft
Community Support
Community Support

Hi @empanado ,

Based on your description, I did a test on my side(using all settings you mentioned), and reproduce your issue.

I agree with your suspicions that “the gallery reads all the items given, and some reset is done to the DisplayLanguage custom property”.  Per my test, I think this is more related to the condition in the gallery Items property. I have tried many ways but still cannot find a solution or a good explanation.

You can see my test results:

When using below formula of the gallery, when run my app, the function on button and HMTL text controls both don’t work(still keep in “en-US” format), but the SortByColumns and Search functions inside Gallery Items property do work:

v-albai-msft_0-1615542922631.png

I am not sure if below formula can work but you can have a try. Since when using a simple table as data source, everything works well. On my side:

SortByColumns(Filter(NewsGallery.Items,If(NewsGallery.DisplayLanguage="en-US",TextInput1.Text in Title, NewsGallery.DisplayLanguage="fr-FR", TextInput1.Text in TitreFR)),"Created",Descending)

On your side, the code should be:

SortByColumns(Filter(colCompanyNews,If(NewsGallery.DisplayLanguage="en-US",txtSearchNews.Text in Title || txtSearchNews.Text in Blurb || txtSearchNews.Text in Details, NewsGallery.DisplayLanguage="fr-FR", txtSearchNews.Text in TitreFR || txtSearchNews.Text in PresentationFR || txtSearchNews.Text in DetailsFR)),"Created",Descending)

v-albai-msft_1-1615542922637.png

If above still cannot work, I think this would be better handled in a support case at: https://powerapps.microsoft.com/en-us/support/pro. The support engineers there have more experiences and more resources, also they can remote to help you dig deeper into your issue.

Best Regards,

Allen

View solution in original post

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

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (20,827)