Bubble is translating the Boolean values

Hello,

I set up multiple languages on the bubble editor settings, but it is translating the boolean values to Spanish, and it is causing problems on the Xano API that can’t read boolean values in other languages. Boolean values should always be in English.

obs: the types of values on the workflows printed are “yes/no”

image

image

1 Like

I have to admit, I have no idea why this is happening, but this is really funny. Haha…

On a serious note, send this to bubble as a bug report. Also, I would change the title of this post to something along the lines of “Yes / no values in API requests sent from API connector are being translated to spanish”. Then I would link this forum post in the bug report.

As far as I remember, it’s always been this way. Also, when the language is set to something like Spanish, API calls get translated. So, in the case of an API call to OpenAI embeddings, I receive 1.344, 0.859, 2.392 which Bubble turns into 1,344, 0,859, 2,392 with the decimals replaced by commas (even though the API response raw body uses the decimal version) . To actually convert them back to useable numbers for things like Pinecone upserting, you have to do 1,344:formatted as number with the decimal set to . instead of ,.

I bet this is the expected behaviour which is why I’ve never reported it. But if it isn’t, it’s crazy it’s happened for this long…

Hi @charleslcts,

If I understand correctly, the screenshot you posted is the request body of an API call. If that’s correct, and if either the primary language or current user’s language is set to Spanish, then that behavior makes perfect sense to me.

After all, Bubble is simply converting a Boolean value into a textual representation suitable for “output” (which would typically be for display in the UI).

Bubble does not (and should not) attempt to understand anything about the specific data requirements of a third-party API. I mean, how could Bubble possibly know whether Zano accepts 1/0, yes/no, or true/false as valid Boolean values in its JSON request bodies. (As it turns out, Zano accepts any of those as valid boolean values.)

So in short, you should add a :formatted as text operator to your boolean expressions intended for use as JSON data in Zano API calls and explicitly specify either 1/0, yes/no, or true/false.

If you’re saying Bubble is mutating the raw response from an API call, then that’s different from the OP’s issue and does seem concerning. Or is the raw response intact and Bubble’s just translating the raw values into the current language? I don’t have much experience with API calls in the context of multilingual set-ups. :neutral_face:

The raw response is correctly formatted as 1.3, 1.4, 1.5 etc and is a List of numbers. However, if you pass that list of numbers to another API call, it formats the list as 1,3, 1,4, 1,5. So it’s not like you can change the raw body of the API response to make it work - the raw body response is correct, but using that list of numbers in another call modifies all the decimals to commas :frowning:

Ah, ok. I think I understand now. In that case, the behavior does make sense. Here’s my take on it…

Bubble converts all incoming API response data to native Bubble types. It does this by using the information provided when the API call is initialized to determine how the data should be represented within the Bubble environment - i.e. which Bubble “type” to make it. (That’s what you’re doing when you “map” the JSON data types to Bubble types during initialization; and it’s the reason that either a JSON string or integer can “become” a date within Bubble.)

This means is that once you have the data within Bubble, it’s a native Bubble type. The raw API response is no longer relevant. In the case of numbers, if that data is then used as part of a dynamic expression which evaluates to anything but a number, Bubble will format it for output, and that means using the current language to render it accordingly. That’s behavior I would expect in a multilingual environment.

If you then want make a subsequent API call to another service using that same Bubble data (remember, the raw response is no longer relevant; it’s all native Bubble types now), the data must be converted from its Bubble type to whatever format is required by the API, which in your case is US decimal format. At this point, it’s really no different than if you’d retrieved a number from the Bubble DB - i.e. you’d still have to convert it to a format the API understands.

So basically, the phenomenon you’re experiencing is in fact the same one as the OP, but as long as one bears in mind the data conversions (to/from Bubble types) and contexts, it all makes sense.
 

I just wanted to note that in the case of Zano booleans, you could also use :formatted as a number with 1/0 (which I think are the default values).

Anyway, hope it helps.

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.