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

Shared component library and Power Automate

Hey all, I'm trynna create a shared component that is gonna serve as I translator text. Basically, I created a list on SharePoint that I search for id and text and get a translated text to replace the content on app. For example, if the user set the language up to English, the login button's text will appear"Login", the same for portughese "Acessar" and so on. I created a flow that filters the appropriated text bassed on id and language passed and returns the result (the translated content).

felipepazts_0-1669153144383.png

That's the flow and the idea was to create a shared Text Component which could execute this flow and get the result (the translated text). So, every time I call it, I would pass the parameter TextId only, and the component, in its Text property, would return the translated text. 

 

I already have a function that does this 

 

 

First(
    Filter(Translations, LanguageTag = LanguageId && TextId = "LoginId")
).LocalizedText

 

 

but I need to pass it for every element in all screens, e.g: button, text, input. Therefore, I'd love if it was possible to create a component Text to be used wherever on the app.

 

This is to create a Text component only, it's not applicable to buttons, inputs or other elements. If you don't get what I meant, plase follow this video that I used as an example.

1 ACCEPTED SOLUTION

Accepted Solutions
cha_cha
Resident Rockstar
Resident Rockstar

Hello @felipepazts 

 

In your component, enable the Access App Scope so it can access your app's data. By design components are isolated so you need to enable that option.

cha_cha_0-1669215331075.png

 


 
Just in case you my answer helped you solve your problem, please mark/accept this as a SOLUTION This helps community members if they experience a similar issue in the future.

 
bistek.space   @cha_bistek    @BisTekSpace 

View solution in original post

7 REPLIES 7
cha_cha
Resident Rockstar
Resident Rockstar

Hello @felipepazts 

 

Your progress is really good but I would recommend trying to lessen your flow call as this will result in a laggy experience. Your planned design route will make multiple flow calls.

 

I would highly recommend that you build up a flow that will fill a local collection in your app to store all the translations so that you call the info within the App. For example

 

On Apps OnStart, you just use English. Like you can have a collection of English words

cha_cha_0-1669165832311.png

 

Then when the user changes language it will trigger to translate all your English words and add the translated words to your collection. Can use AddColumns here.

cha_cha_1-1669165907660.png

 

then on your control's Text property to be like 

If(Translate,LookUp(col,ControlID=ButtonA).TranslateResult,LookUp(col,ControlID=ButtonA).English)

 
Just in case you my answer helped you solve your problem, please mark/accept this as a SOLUTION This helps community members if they experience a similar issue in the future.

 
bistek.space   @cha_bistek    @BisTekSpace 

Thanks for replying to me, @cha_cha . I tried something similar to this, however, I couldn't read the collection inside the component. The idea is to pass the textid to the component and inside it, to run the Lookup, Filter, whatever function.

The image below is related to the component I've created and as you can see, it can't find the translations collection.

felipepazts_0-1669215120793.png

 

cha_cha
Resident Rockstar
Resident Rockstar

Hello @felipepazts 

 

In your component, enable the Access App Scope so it can access your app's data. By design components are isolated so you need to enable that option.

cha_cha_0-1669215331075.png

 


 
Just in case you my answer helped you solve your problem, please mark/accept this as a SOLUTION This helps community members if they experience a similar issue in the future.

 
bistek.space   @cha_bistek    @BisTekSpace 

Hey @cha_cha 

Is there any extra config to enable this property?

felipepazts_0-1669216539638.png

 

Just a reminder, this is how my shared componet library looks like

felipepazts_1-1669216659524.png

I'm working on the LabelMultipleLanguage and inside it I have a Text label component.

felipepazts
New Member

@cha_cha , I was looking for this flag here and I discovered that this is enabled in component tab, however, I'm using the shared component library. So, my question now is: what is the difference between the components created on the app (components tab) and the components created such as a shared component 

 

felipepazts_0-1669217386118.png

The components I was trying to implement have been created on the Component libraries, nonetheless, this feature you mentioned above it's only possible to be accessed from the components tab inside the app.

cha_cha
Resident Rockstar
Resident Rockstar

Hello @felipepazts 

 

For your requirement, please create the component within the App.

 

Shared Components are designed to be shared across different apps in an environment. They are by default isolated to ensure that they have no dependency on certain data sources. Most common function Shared Component are like App Banner, Footer. But I think it can do more but I don't have experience in that part yet.

 

Components can be created in a Shared Component way (isolated) or you can allow it to access the app's current data. This action actually builds dependence on app so it can't be easily shared with other apps who don't have database. 


 
Just in case you my answer helped you solve your problem, please mark/accept this as a SOLUTION This helps community members if they experience a similar issue in the future.

 
bistek.space   @cha_bistek    @BisTekSpace 

Thanks a lot, @cha_cha . you were very helpful!!!!. Thank you!!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,576)