1

I have a weird situation. I as an admin have the preferred language set to English and I want to edit another user that has a preferred language set to something different (French for example). When I click the edit button, the url contains the "fr" prefix and obviously the site's language is changed. It goes back to english if I save the changes or if I set the administration language to English for admin account, but if I just continue browsing the site's language will be changed to French because of that prefix.

Is there any way I can edit any user without having the language prefix in the url if they have a different preference? Thanks.

3
  • Where are you doing the editing? If the edit link is the one on the People admin page, you should be able to edit the view that generates that page and strip the language prefixes from the link URLs. Oct 9, 2023 at 20:59
  • yeah, already did that. I had to manually create the edit user URL using the "Global: Custom text" field and rewriting the output as a custom link. Now I have an issue with email user url but I think I can fix that by using manually crafted url using different tokens. You can write that as an answer so I can accept it :) Oct 10, 2023 at 7:51
  • On the contrary, I think you should add that as an answer and I'll upvote it, since you did the work to prove that the approach is actually effective. Oct 10, 2023 at 11:55

1 Answer 1

0

There are various factors that can influence which language is used to display a page. For example,

  • The language prefix in the URL
  • The user's selected language
  • The user agent (browser) language

Drupal lets you choose the priority for each of these. Further, you can set a different preference for Interface language (the UI language) and Content language.

To do so, as an administrator, visit /admin/config/regional/language/detection.

It sounds like you want to make sure that Account administration pages is enabled and at the top of the list for Interface language detection.

5
  • As I already mentioned, the administration language is set to English but the url contains the "fr" prefix. So if you continue browsing (clicking on other links) without saving the form, the "fr" prefix will stay forever and the site's language is changed Oct 6, 2023 at 15:28
  • @MariusIlie Yes, I read that, which is why I suggested changing the priority of the prefix; the administration language has to be set to supersede the prefix, which you can do in the admin UI. Oct 6, 2023 at 21:37
  • The administration language is first in the list, is set to english, the interface is displayed in english even though the url contains the fr prefix. This is not an issue. The problem is that if the user edit url contains the fr prefix and you browse away from this page the prefix stays. And if you are not on an administration page the site language is set to fr. Oct 7, 2023 at 3:57
  • You should be able to configure Content language detection (below Interface Language Detection) then to prioritize the user account language (User) over the prefix (URL). Note that this will apply to all authenticated users, not just admin. Oct 7, 2023 at 6:18
  • I know all those things, that is not the issue. The question I asked is in the last sentence: Is there any way I can edit any user without having the language prefix in the url if they have a different language preference? Oct 9, 2023 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.