107
Views
9
Comments
How to change language (application locale) in layaut and reload screen?
Question

I want to change app locale in layaut and reload the screen but i don't want to use event for every folmular in the application.

Hello first of all, what type of application are you working on? Web, Mobile, Reactive?

And can you explain better what you intend to do, so that we can help you?


Cheers,

Miguel

Rank: #6190

Hello, my problem is how to implement switch button to change language in a layout. The problem is, i need to reload the screen and i lose my data from folmular. To do that i can use events, but it is not comfortable because then i have to do changes in many modules and screens, because that layaut is used for many screens. In traditional web applications that was not a problem, but in react application if i just redirect to the same screen i lose data from folmular. The question is how to do that in reactive forms?

Hey Jordan,

I think you are trying to change the screen text based on the locale selected, if that is the case then of course your screen needs to know when to change it. As far as event handling goes you can make the event non mandatory which allows you to omit the handler if you don't need it.

Hope this helps!

Junaid

Hi,

Let me recapitulate the issue. We want to achieve a functionality that in the Traditional Web App is implemented as follows:

  • the SwitchLanguage control has links bound to every language
  • These links are of the type: Submit (and point to an empty Screen Action)
  • Therefore selecting a new language fires a postback that forces rendering the whole screen - with new translations but with all user data (inputs) preserved

The core question is: how to achieve such functionality in the Reactive Web App model? Selecting a new language causes the Locale to be set to the new value but how to force the whole screen to be rendered with new translations? The SwitchLanguage control is placed on every screen - in a placeholder exposed by the main layout control. The re-rendering of the screen must be forced at the level of these controls - end-screens must not know anything about switching languages. And the solution: get the current URL and redirect to it, is not satisfactory because it will cause user's data lost.

Regards

Tomasz