API call fails if page language not English

Hi everybody, I would guess API calls have nothing to do with page language but here’s what happens.

I have a container in a page and the container’s data source is an API call that I’ve set up in the API connector. The API call picks its input from the current user fields in the DB that get populated by other pages.
Like this:

The 2 text fields Input1 and Input2 are filled with the same current user’s fields that feed the API, as a test.

When I preview the page with no language set in the URL or with lang=en_us everything works fine, the 2 textboxes show the user’s relevant fields and the API call works as expected.

If I preview the page with a language other than English in the URL, the textboxes still show the values contained in the DB but the API call throws an error because its input fields (that are the same as the textboxes) are empty (at least I’m guessing they are empty, as the API just says inputs are invalid).
I can choose any language, regardless if I have translations for that language in the Languages section or not, and they all fail.

Funny thing is that if I specify a language whose code starts with “en_” everything works even though the language code is nonexistent (like en_xx in the picture below).

That’s definitely beyond my comprehension… :flushed:

Other languages will format numbers like 3,2030 for 3.2030, which will break the call. As such, use :formatted as with a decimal separator rather than comma if your app uses multiple languages.

Thanks man! :+1:

1 Like

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