Event Handler: User Locale of NotAuthenticatedUser

I’ve created an Event Handler where I make use of the User Local to decide what should happen. It’s working fine for authenticated users, but obviously not for not authenticated users.

Is there any way to get the user locale of the user’s device resp. the user’s browser?

Hello @sdanieli

Do you use ui-builder for your app?

Regards,
Viktor

Yes!

@sdanieli

You can use this block to get user locale

1 Like

Thanks, but how do I get the Client Locale to the backend (resp. my Event Handler), when using the Load Table objects block … :thinking:

Do you need to use the client locale in the database query?

Not exactly in the query itself, but I need to modify the result in the After Find Event Handler based on the User resp. Client Locale.

Got it. In this case, the approach I’d recommend would look like this:

  1. Create an API service that would be responsible for retrieving the data from the database (it can be done with codeless)
  2. One of the arguments for the API service would be the client locale. When the service retrieves the data from the database, it performs the required filtering of the data based on the locale parameter.
  3. Invoke the API service from your UI Builder page.

Hope this helps.

Regards,
Mark

1 Like

I had exactly the same approach in my mind. :grinning:

Great to hear that the head of the Backendless experience would approach it the same way. Thanks again.