Let each subrequest have an independent langcode instead of all of them using the master request's langcode

Created on 14 April 2024, 7 months ago
Updated 13 June 2024, 5 months ago

Problem/Motivation

I'm not sure if this feature will be popular or if it would be a specific use case for me, but currently, the subrequests module will only use the master request langcode, but this might not be optimal when using it with the 'decoupled router' module. In my use case, the first subrequest would be for the 'decoupled router' module to translate the path, but I still don't know the language of the target entity, I want to let my second subrequest to handle the language by itself.

Steps to reproduce

My website default language is English, but I did a subrequest with these parameters:

[
    {
        "requestId": "req-1",
        "uri": "/router/translate-path?path=/ar/some-arabic-content",
        "action": "view"
    },
    {
        "requestId": "req-2",
        "waitFor": [
            "req-1"
        ],
        "uri": "{{req-1.body@$.jsonapi.individual}}",
        "action": "view"
    }
]

I expect the second subrequest to fetch me the Arabic content, but it will fetch me the English one since the default language is English.

Proposed resolution

Maybe we should reset the language manager for each subrequest? I'm not sure exactly if this is the best solution. I will assign this issue as a feature request instead of a bugfix since this might be an intended functionality.

Feature request
Status

Needs work

Version

3.0

Component

Code

Created by

🇯🇴Jordan yahyaalhamad Palestine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024