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 Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (3,221)