I cannot figure this one out. I have a multilingual site I am working on, two languages setup (default is english). Requesting a menu endpoint for a language was working. So:

For english menu, the request endpoint:
.../api/menu_items/main?_format=json

For italian menu:
.../it/api/menu_items/main?_format=json

* Notice the locale for the italian menu within the request, it. This was all working.

But then I applied a small patch to fix an issue from another module, schemata. Now, anytime after doing a clear cache, whichever menu language I request first results in both endpoints always loading this same language. In other words, if I go to the italian menu endpoint first (after clearing cache), the other english endpoint also loads italian. And the same if going to english (after clearing cache), then both endpoints load the english menu.

If I revert the patch from schemata then the endpoints respond correctly for their respected language.

I made a comment here too:
https://www.drupal.org/project/schemata/issues/3063027#comment-13196650

Comments

hga77 created an issue. See original summary.

fabianderijk’s picture

Status: Active » Closed (won't fix)

Based on your description of the issue everything was working before you applied the patch to the other module. This makes me suspect it has something to do with that one. I've tested locally and everything works fine for me.

harcher’s picture

Thanks for looking into this. Yes I believe it's something related to the patch I applied from that module. But still makes me wonder why it would affect the behaviour of this module in this way. I did manage to find a work around. What I did is have english menu load with _format=json and the italian with _format=hal_json. This works for some reason!