Use interface language on the add URL alias form

Created on 23 May 2024, 6 months ago

Problem/Motivation

When adding a new URL alias, the language field is not selecting the current UI language.

Steps to reproduce

Go to /admin/config/search/path/add in a non default language.

Proposed resolution

Use the language manager to set the default option to the current language.

📌 Task
Status

Active

Version

11.0 🔥

Component
Path 

Last updated 3 days ago

  • Maintained by
  • 🇬🇧United Kingdom @catch
Created by

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

Merge Requests

Comments & Activities

  • Issue created by @j_bekaert
  • Status changed to Needs review 6 months ago
  • last update 6 months ago
    Custom Commands Failed
  • Status changed to Needs work 6 months ago
  • The Needs Review Queue Bot tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • Status changed to Needs review 6 months ago
  • Pipeline finished with Success
    6 months ago
    Total: 628s
    #180992
  • Status changed to Needs work 6 months ago
  • 🇺🇸United States smustgrave

    Can we add a simple test assertion for this.

  • 🇬🇧United Kingdom james.williams

    I was looking into whether the work here could help resolve #2484411: Manual path aliases are not the same as aliases on the node form on single-language sites by ensuring new aliases were created in the same language on the standalone path creation form, but I noticed that the current approach overrides the language when editing any existing path alias entity (which might already have a specific language). I think this should only be about setting the default initial value on creating an alias entity? So I've pushed a fix for that.

    I've also made it respect the language settings configured at /admin/config/regional/content-language which allows choosing what the default language for aliases should be (which itself defaults to the site language), so that this is actually configurable too.

  • Pipeline finished with Success
    about 2 months ago
    Total: 1758s
    #298174
  • First commit to issue fork.
  • Pipeline finished with Success
    about 1 month ago
    Total: 547s
    #306481
  • 🇮🇳India vinmayiswamy

    Hi, I have added test case to validate the path alias functionality across language switches. This test verify that the correct language is selected in the UI when creating aliases for nodes in different languages, ensuring users can easily access the aliases based on their current language.

    Please review the changes, and let me know if any further adjustments are needed. I appreciate any feedback or suggestions for improvements.

    Thanks!

  • Pipeline finished with Running
    about 1 month ago
    #306585
  • Pipeline finished with Success
    about 1 month ago
    Total: 1047s
    #306654
  • Pipeline finished with Success
    about 1 month ago
    Total: 1790s
    #306762
  • 🇬🇧United Kingdom james.williams

    I've run the test-only pipeline job, which passed - i.e. your test passes without the changes. The test is simply checking that aliases work for nodes that happen to be called 'English node' or 'French node'; it's not checking that the aliases are created in an appropriate language for appropriate node translations. I also believe the monolingual scenario should be covered: aliases should be created in the same language on the standalone alias form as when creating them via the node add/edit form (i.e. the site default language for both; whereas the standalone alias form creates aliases as language-neutral without these changes).

  • 🇬🇧United Kingdom andrew.farquharson

    @james.williams

    I also believe the monolingual scenario should be covered:

    But that is what issue #2484411 is about is it not? So should be fixed in that issue?
    At #8 @smustgrave requested a 'simple test'. Is that not now in place?
    At #9 you linked #2484411. It will help if the issue description is filled out especially the 'steps to reproduce'. But if the test coverage covers this issue then perhaps #2484411 can be dealt with as a child issue. Under it the test coverage can be extended.

  • 🇬🇧United Kingdom james.williams

    I interpret the current ticket description as being about ensuring that the right language is selected for creating aliases in, from the URL alias form. At the moment, the alias form creates aliases as Language Neutral (shown as 'Not specified', see the screenshot I've added for the issue summary). So regardless of whether a site is monolingual or multilingual, aliases are not currently created in the interface language. I believe that is what a valid test should show.

    Normally a test should fail to show an expectation isn't being matched, and then pass when run alongside a fix. At the moment, the test is passing against core itself, because it is not checking the unexpected behaviour. Yes, perhaps that's just because the issue wasn't clear enough - so I've updated the steps to reproduce, including that screenshot.

    Another way of testing could be to check whether an alias added through the standalone URL alias form is given the same language as an alias created from a node creation form. At the moment; they would be different. That is the angle that #2484411: Manual path aliases are not the same as aliases on the node form on single-language sites looks at this problem from. I believe both of these issues can be solved with the solution that I added in MR !8175 for this issue.

    My MR changes did go a bit beyond the basic request, to respect the configurable language content settings for more flexibility for different use cases.

  • 🇬🇧United Kingdom andrew.farquharson

    @james.williams Thank you, the new 'steps to reproduce' make things nice and clear. It appears that the test should be quite simple and specific: the default setting of one particular field in the form.

    Another way of testing could be to check whether an alias added through the standalone URL alias form is given the same language as an alias created from a node creation form. At the moment; they would be different. That is the angle that #2484411: Manual path aliases are not the same as aliases on the node form on single-language sites looks at this problem from. I believe both of these issues can be solved with the solution that I added in MR !8175 for this issue.

    This all sounds good to me.

Production build 0.71.5 2024