When an admin performs actions on the Orders view, the operation urls don't use the admin language.

"View", "Edit", "Reassign" and "Delete" return non-multilingual urls.
Only the "Payments" operation will redirect the admin to an url in his current language.

Proposal

Add LanguageManagerInterface to OrderListBuilder.

CommentFileSizeAuthor
#2 3248322-2.patch3.91 KBsimgui8

Comments

simgui8 created an issue. See original summary.

simgui8’s picture

StatusFileSize
new3.91 KB

Here is a patch.

simgui8’s picture

Status: Active » Needs review
jsacksick’s picture

The documentation says the following:

* - 'language': An optional language object used to look up the alias
* for the URL. If $options['language'] is omitted, it defaults to the
* current language for the language type LanguageInterface::TYPE_URL.

Besides, we don't specify it for payments, so why would we need to specify the language here?

simgui8’s picture

Thanks jsacksick for the follow-up.

On a fresh Drupal 9.2.8
with latest Commerce 2.x-dev.

Here is the multilingual url structure, which is pretty common:
d9.ddev.site/fr/admin/commerce

When navigating to order:
d9.ddev.site/fr/admin/commerce/orders

Here is the operations urls links for an order:
d9.ddev.site/admin/commerce/orders/1
d9.ddev.site/admin/commerce/orders/1/edit
d9.ddev.site/admin/commerce/orders/1/reassign
d9.ddev.site/fr/admin/commerce/orders/1/payments
d9.ddev.site/admin/commerce/orders/1/delete

Only payments have the language structure.

Now, let's say I am a french admin. Most actions I do will bring me to a page in my language.
But not order operations.
This seems awkward to me.

jsacksick’s picture

I'm not saying we shouldn't fix this, or there's no bug. I'm just saying that we don't specify the language for the "payments" entity operation but yet the link correctly contains the "language" code. That's all.

simgui8’s picture

Ok!
I'll be glad to help if there is a better approach than #2 or if I should improve it.