[Multilingual Component] What are the best practices to use the MultiLingual Plugin Actions

Forge Component
(15)
Published on 2019-10-04 by OutSystems R&D
15 votes
Published on 2019-10-04 by OutSystems R&D

Greetings Folks,

I am using the multilingual plugin in the mobile app & as far as documentation guide, I followed the same path.

But have some queries to be clear :

1-  I am using AddTranslationsFromResource action in OnAppReady Event. Is it feasible to call this action i.e load resource every time? I see the action definition & the LOAD-JS is using an XHR call to Webserver in order to download this resource i.e JSON from Server.

  Whenever I open the app , I also observe a minor lag the moment I started using this plugin coz the action is called in OnAppReady Event,


2- What if I didn't use the action in onAppReady & call it only once when I Logged User.

    Not this will get stuck when I update translations & things will be updated only when user login-logout.

So more often I am trying to find some best practices with the plugin Implementation.

Any help much appreciated.

thanks,

Assif 

awaiting for any response

Kindly

Solution

Hi assif,

You are right about that asynchronous issue, the first screen might not be translated right away. A possible workaround is to add this:

To the OnInitialize event of your screens (better: encapsulate it in a central client action you can call on all onInitializes). It should give a performance warning for every screen, but you can safely hide it, as it will only have impact the first time users open the app (to load the resources).

Putting this on the login would be another idea, but because users might use the remember login they might not go through that screen.

Cheers,
Tiago Simões

Solution

Hi Tiago Simões,

Thank you for the reply :)


I would instead prefer to use it on any 1 screen or at least back in onAppReady because the action is totally dependent on Internet Connectivity. So adding this will be a headache & need to validate with connection status in every screen... as of client except OS apps to work easily in Offline.

I was also more concerned about whether or not the translation will work when the app is offline.

Perhaps coming to the point, can you do me a favor to reply to the 2 questions I posted by addressing specifically.

Kindly




1 - I believen OnAppReady should not run when you resume the app (but I'm not sure). Also because the resource is local, it is packed in the apk. Are you experiencing issues when you go offline?

2 - Yes, you can try on the OnLogin, just remember that if you have a remember login, users will not go through that screen.

Tiago Simões wrote:

1 - I believen OnAppReady should not run when you resume the app (but I'm not sure). Also because the resource is local, it is packed in the apk. Are you experiencing issues when you go offline?


The action definition & the Load-JS is using an XHR call to Webserver in order to download this resource i.e JSON from Server. So is it really a local resource... I don't think so.


Hi Assif,

You will not need to worry about it, the resource will be stored on the device and the platform assures that call will work correctly, even when you are offline.

Cheers,
Tiago Simões

Thanks Tiago Simões,

For instance, referring the conversation & documentation :

- Added a validation check of NetworkStatus to not call the AddTranslationFromResource action

- And yes I did test the updates & offline, it is working smoothly.