[SOLVED] Flatten to Master language for unsupported language codes

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [x] Documentation issue or request

Current behavior

When requesting a single language that is not a member of Squidex.Infrastructure.Language (Languages.cs) using the X-Languages and X-Flatten headers against the content/{app}/{schema}/{id}/ endpoint, all languages are returned.

Expected behavior

Only the master fallback language would be returned and the data would be flattened.

Minimal reproduction of the problem

Pass “foo” as the language code (or de-BR).


App Name: n/a

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [x] Self hosted with other version
  • [ ] Cloud version

Version: Master branch at commit: 373d05f74076ee1f4d70e38e262ed90d8c3d7efe


  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Running the latest master branch from this morning (15/04/2022) locally from Rider and using Postman for the requests. Wondering why Squidex.Domain.Apps.Entities.Contents.ContentExtensions.Languages doesn’t add the App's master language if it finds no matching ISO language for the requested language code.
I realize this is highly unlikely, I noticed it using “foo” as the language code to test what happens if an unconfigured code is supplied but now realize this behavior is only if the code is not in the LanguageByCode Dictionary so apologies if this is a distraction, I assume all the codes supported by the major browsers are in the list.
There is a minor (near impossible) risk of a language code that is missing from the list being supplied (I don’t have a specific language in mind, Brazilian German just happens to not have an ISO code so I mention it, I won’t actually need it and assume the major browsers won’t have it) so more asking out of curiosity. If it did happen though, the client would have to handle the unflattened data and act accordingly.

For a very long time, custom language codes were not supported. I think the check in ContentExtensions does not make sense any more.

You can try it out if it works if the check is removed and provide a PR if you want.

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