[New Feature] Multi language support

Oops. Please disregard that question - the fever must have been affecting me… :slight_smile:

I was actually trying to find out if there is an easy way to do session-based languages without modifying all the navigation actions and pages to send and receive language. So that I could have a dropdown on the header for people to choose their language. Before they sign up or log in (where their saved language would start taking precedence).

The aforementioned question came from the fact that I was trying to make changes to a thing (Current Language) and somewhy it failed miserably. Consistently. Oh well. Might as well have tried to change website admin email just like that… :smiley:

Aight. found out that one, too. It does sessions automatically. based on temporary or logged-in user. Nice.

Now the next question would be that is there a good way to detect the location of the visitor or their browser language and use either of these to display the site in a language that would probably be most suitable?

1 Like

If you’re on https, the current position can returns the country, so you can deduct that from it.

Hmm. If I visit a webpage and it wants to know my location as a first thing (my browser alerts me to that) I’m terribly inclined to disallow it for privacy reasons, https or no. I’d think there are more than a few like-minded individuals so that would render this rather useless as a language detection mechanism.
For that end couldn’t we use user’s IP address?

That’s no guarantee either.

I would be inclined to use the browsers language code transmitted in the header “HTTP_ACCEPT_LANGUAGE” and default to EN if not present.

1 Like

That looks like the winner among the choices.

However I think I’m not proficient enough to implement that out of the blue…
could you throw me some hints as to how would I do it?

@Arche, I don’t know who that was directed at, but my suggestion was about @Bubble implementing this (HTTP_ACCEPT_LANGUAGE header detection) at their end or providing a function to read this on the application.

I don’t know if it can be done / read any other way.

1 Like

@emmanuel I agree with @DaveA, detecting language is supposed to be a server-side function.

There is a discussion here on reading from the client side, and how it can be done but is not as accurate as the server getting it:

@Arche if you don’t want to wait for the server implementation, there is a messy hack to read it clientside with javascript.

And the messy hack is …

Input text element, placeholder text “language-input”.

HTML element, content:

<script type="text/javascript"> if ("pageloaded" === "yes") { var lang = navigator.language || navigator.userLanguage; $('.bubble-element .Input[placeholder="language-input"]').val(lang).change(); } </script>

Replace pageloaded with a dynamic expression for the page loaded entire.

Workflow event for the input text value changed and is not empty.

3 Likes

thanks for the hack - seems messy enough :slight_smile:
I’ll give it a whirl when I get the more important functions off the ground and out of the way.

@DaveA, thanks for the clarification, my comment was meant to be a reply to your idea.

So then on to raising social awareness about the merits of server-side language detection and hoping that one day it may come to bubble evolving to the point that this awesome capability is at our hands. Nice. @emmanuel.

1 Like

Cant we use the condition WHEN CURRENT LOCATION IS X, SET CUSTOM STATE TO Y, where X is the geolocation code and Y is the language code? This way it will change the language automatically? Has anyone tried it live?

There seems to be a little issue with this code when using in Bubble.

I have setup a language field on the user and when that is set to anything other than english it will mess with the dynamic data in the code snippet.

Instead of the condition to provide ‘yes’ it will provide ‘yes’ in the language you have set for the user, thus breaking the code.

For example, when I change the user language to es_es I get:

image

image

Of course it doesnt understand ‘si’ so it will return empty. It also happens with other languages.

The solution seems to change the “yes” part in the static code to the same dynamic data you replaced pageloaded with.

Just not sure why it behaves like this, perhaps @mishav has more knowledge to explain?

The combination of this code with the Apptext feature works great. When the page is loading the code will check if an input field is empty and then populate with the language code.

A workflow on the page will check if the input is not empty AND the current user’s language is empty and if both are positive, it will set the current user’s language to the input’s language and the Apptext changes are immidiate for the pages I checked so far.

The only issue with this is that the code retrieved from this is not exactly the same as the presets in Bubble. So for Dutch it will come up with ‘nl’ where Bubble only recognizes ‘nl_nl’.

I will have to look into all possible options this code comes back with and then perhaps put them in a separate data type so it can lookup the correct Bubble language value for the code’s language value. Little cumbersome, but unless we can manually change the language settings in Bubble, I think this is a viable solution.

It seems this is actually causing issues in IE. It’s a bit hard to replicate because in one view it displays the language input and in another refresh it doesn’t.

Anyone else noticed this?

1 Like

How do we deal with dropdowns for multiple languages, many of actions are derived from dropdowns?
Secondly how do I provide two languages in data, like if there is an entry by the name ‘oranges’ in data and in other language it is called ‘xyz’ how do I show ‘xyz’ to user who has chosen the secondary language, primary being english?

1 Like

Hi, Can someone please suggest.
I am unable to figure it out, the only way I can think of is making another overlapping dropdown and duplicating workflows, there should be a better way.
Also please suggest regarding two languages in database.

Hi @emmanuel, I assume the forum does not have answer to this, can you please guide.

We currently do not support conditions for captions so building two dropdowns is probably the best way. We’ll look into it but we cannot give a timeline yet.

I see, not a very big problem but yeah time and space consuming, I hope you guys come up with a solution soon.
What about the second problem, how to populate database, will that too be required to be duplicated?

Hi @emmanuel,
I just discovered that the alternative language option is available in slide-bar menu, is it really challenging to incorporate the same features in dropdown menu and radio buttons?

1 Like

Hi, I’m new to Bubble and trying to setup some best practices for managing multilingual datas / content.

Ho do you structure your datas and how do you build the query ?

For exemple if I have a product list and I want name and description fields to be available in several languages, how do I store them in a clean and efficient way and how do I query them based on User language ?

Here is what I tried (it works but not sure if there is better ways to deal with it) :

This is (more or less?) the approach #4 from this article

Thank you for your insights,

:::: Update :::::

After 2 more weekends… here is the improved query (I understood how to link different tables):

image

Hello.

How can we carry the ‘lang’ query parameter across all pages by default for users without a language settings (ie, anonymous users)?

What I mean is that, when an anonymous users lands on our website, he can change the language of the site, and we modify the lang query string with the language he selected.

But the links on that page don’t carry the lang query parameter, so when the user clicks on any of them, the new page will be in the default language, not in the language he selected in the previous page.

Sure, we could update the temporary user thing, but I was also thinking of Google Bot. If we wanted Google to index every localised version of each page, it would be handy if Google Bot could navigate the pages on the language it is expecting.

Regards.

1 Like