Steps to reproduce
- Install Drupal
- Enable Language and Content translation
- Enable a second language (e.g. Italian)
- Enable translation for basic page content type
- Create a new basic page
- Select Italian for the language instead of English
- Save
- You are taken to the default/English node path (
/node/1) instead of Italian (/it/node/1)
Proposed resolution
Expected result would be to view the translation you just created
Remaining tasks
See comment #16
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
Original report
Enabled content translation, such as English and Japanese.
If at English page, i want to add new content, but i selected Japanese language on Language field.
After save, the system will redirect to English content, not Japanese content.
Comments
Comment #4
raman.b commentedResolving failed test case and adding basic test coverage to demonstrate the reported bug
Comment #6
nishat ahmad commentedDisabled Language from Manage form display and check the screenshot.
Comment #11
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #12
pameeela commentedStill happening, updated IS with some clearer steps to reproduce.
Comment #13
ranjith_kumar_k_u commentedRe-rolled #4
Comment #14
ranjith_kumar_k_u commentedComment #15
rinku jacob 13 commentedI have tested the issue in drupal version 10.1.x (https://simplytest.me/). Applied above patch and i got the solution. Adding Screenshots for the reference . Need RTBC+1
Comment #16
smustgrave commentedPatch #13 does solve the issue.
But language_manager should default to NULL and throw a trigger_error that this will be required in D11. For backwards compatibility.
That will need a test to verify the trigger_error is returned.
Then a change record should be added.
Comment #17
ameymudras commentedTried to address the concerns in #16 and it still needs changes to the tests
Comment #18
ameymudras commentedComment #19
smustgrave commentedThis was my mistake the change record will need to be created and trigger_error updated.
Also there needs to be test coverage of trigger_error.
Comment #21
heikkiy commentedThe latest patch does not seem to apply anymore against core 10.2.
Comment #22
leo liao commentedSupports 10.2.x
Comment #23
leo liao commentedComment #24
recrit commented@leo liao thanks for the 10.2 patch. Any code fixes are applied to the latest dev branch - 11.x.
Comment #26
recrit commentedThe https://www.drupal.org/files/issues/2024-03-01/3096570-22.patch patch applies cleanly to 11.x. I have created the MR 7350 to move this ticket along.
All patches on this issue have been hidden. The MR should be used for any updates.
PENDING WORK - see https://www.drupal.org/project/drupal/issues/3096570#comment-14954234
Comment #27
recrit commentedPENDING WORK
Comment #28
recrit commentedAttached is static patch of the MR 7350 for 11.x and a patch adapted for 10.3.x
Comment #29
recrit commentedCleaner patch for 10.3.x with no tests
Comment #30
peterwcm commentedCould we use the node language instead? In that case, we don't need to introduce a new language service too.
['language' => $node->language()]Comment #31
recrit commented@peterwcm thank you. Using the node language worked for me and is a lot cleaner. I will update the PR.
Comment #32
recrit commentedMR passed.
Attached is an equivalent 10.3.x for any builds still using that.Disregard the attached 10.3.x patch here, it was an erroneous upload.
Comment #33
recrit commentedlet's try adding that 10.3.x patch again for any builds still using 10.3.x.
Comment #34
recrit commented10.3.x patch with no tests
Comment #35
peterwcm commentedThanks @recrit
The changes look good. The issue applies to new node creation and editing the source language of an existing node, which I think should be the default behaviour. Tested and it worked as suggested.
Comment #36
alexpottCommitted and pushed 6c01bb31917 to 11.x and f86f182a989 to 11.1.x. Thanks!