When you try to edit a translation which language is different than you have in your user account "Administration pages language" setting, you are redirected to the editing page in that language.
For example, if I try to edit a spanish translation and I have setted english in my user account, I'm redirected to the english edition page.
Steps to reproduce:
- Go to: /user/YOUR_USER/edit
- Set a value in 'Administration pages language' different to: '- No preference -'
- Try to edit a translation of any content, menu, taxonomy...
- Note the link points to the language setted in your user preferences.
Comment | File | Size | Author |
---|---|---|---|
#16 | 2677778-interdiff-14-16.txt | 1.32 KB | Leksat |
#16 | 2677778-16.patch | 5.97 KB | Leksat |
#3 | Multilingual_site_and_user_Administration_pages_language_setting-drupal-2677778-3.mp4 | 2.76 MB | facine |
Comments
Comment #2
Gábor HojtsyDid you encounter this with core only? I don't believe there is any language based redirects in core to begin with.
Comment #3
facine CreditAttribution: facine as a volunteer commentedYes, only with core.
Attach a video: https://www.drupal.org/files/issues/Multilingual_site_and_user_Administr...
Comment #4
Gábor HojtsyAll right, so you are not redirected (note the URLs before clicking on them), but you get different URLs generated.
Comment #5
Gábor HojtsyComment #6
krlucas CreditAttribution: krlucas at Genuine commentedThis seems to affect users who have access to edit entities. Users who can only translate can still access the translation links output on the entity translations overview page.
By design, it appears, ContentTranslationManageAccessCheck blocks editors access to the entity.$entity_type_id.content_translation_edit route:
And the overview controller always provides editors with links to the entity edit page:
But the entity.$entity_type_id.edit_form route always loads the translation of the currently negotiated language.
Allowing editors to edit translations in the admin interface language of their choice seems like a pretty big use case. When we build multi-lingual sites for clients the person creating nodes and adding translations frequently is just copying pasting and is not actually a speaker of the languages of the content they are entering.
Comment #7
Leksat CreditAttribution: Leksat at Amazee Labs commentedWould it make sense to add the translation language as an additional parameter to the entity edit route? Just like in D7 entity_translation we can edit a German translation within the English interface at
/en/node/1/edit/de
.Also, if we decide to make it, I would not change the language in the URL. I mean that it would be nice that translation links at the
/en/node/1/translations
page lead to/en/node/1/edit/en
and/en/node/1/edit/de
, so no language interface switching happens.If we implement the above, both "Account administration pages" language detection method and "Administration pages language" setting are useless and can be removed.
Comment #8
krlucas CreditAttribution: krlucas at Genuine commented+1 for #7 to add (back) a language suffix to the entity edit route and restore the D7 admin interface negotiation pattern. Seems like the simplest fix.
Comment #9
Leksat CreditAttribution: Leksat at Amazee Labs commentedWorking on a patch.
Comment #10
Leksat CreditAttribution: Leksat at Amazee Labs commentedHere is a patch.
1. It clones entity edit form route, adding the language parameter
2. It uses hook_entity_prepare_form() to set the entity translation (fetching language from the current route match)
I'd love to hear if there are better ways to implement this.
Comment #11
Leksat CreditAttribution: Leksat at Amazee Labs commentedFrom my #7:
Actually there are many ways to get to an admin page in a non preferred language. So the mentioned features are still useful.
Comment #12
Leksat CreditAttribution: Leksat at Amazee Labs commentedUpdated links on the entity overview page. Test fails are expected.
The only issue I see for now, tabs are gone on the edit form.
Comment #14
Leksat CreditAttribution: Leksat at Amazee Labs commentedChanged the whole thing a bit. Here is what the patch does:
- adds optional content_translation_language parameter to the edit route
- uses hook_entity_prepare_form() to set a desired entity translation on the form
- uses hook_entity_operation_alter() to add translation language to the edit link
Comment #16
Leksat CreditAttribution: Leksat at Amazee Labs commentedFixed URL in test.
Comment #17
Leksat CreditAttribution: Leksat at Amazee Labs commentedGreen light!
Comment #19
Gábor HojtsyIs this in some ways related to #2189267: When content language detection is different from interface language detection, the detected language is not applied to the rendered content?
Comment #20
Leksat CreditAttribution: Leksat at Amazee Labs commentedAfter some usage of #16 on a dev project, we found several issues with the patch. (I can provide some feedback if anyone is interested)
Now I think that we need to fix #2189267: When content language detection is different from interface language detection, the detected language is not applied to the rendered content first and then try to solve the issue with the language detection configuration.
Here is a screenshot of the configuration that should solve the issue:
@Gábor Hojtsy, thanks for mentioning that issue!
Comment #21
Gábor HojtsyYeah #2189267: When content language detection is different from interface language detection, the detected language is not applied to the rendered content needs tests, it would be really helpful to help with those :)
Comment #22
Leksat CreditAttribution: Leksat at Amazee Labs commentedI manually tested #2189267-24: When content language detection is different from interface language detection, the detected language is not applied to the rendered content with the #20 language detection configuration.
I was able to create/edit content translations. So I think we can close this issue.
I found one small additional issue and reported it to #2715887: Can't use translated field default values when "Administration pages language" setting is set