The set-up is as follows:

1. Enable entity translation module
2. Enable field translation on a content-type
3. Enable workbench moderation on the same content-type
4. Create a node in the base language and publish it
5. Select the translation tab and create a translation, publish it
6. Look at the url alias for your two nodes in admin/config/search/path/list and notice that there are two paths one in each language
7. Edit the translated node and manually change the path
8. Refresh the url alias listing and now the original node and the translated node url aliases are both set to the translated node's language

CommentFileSizeAuthor
#1 et_language-1946392-1.patch701 bytesjoel_osc

Comments

joel_osc’s picture

Status: Active » Needs review
StatusFileSize
new701 bytes

Here is a patch which seems to fix it by changing how workbench moderation decides on the path language. I just copied the method from the path module which uses "$langcode = entity_language('node', $node);"

alanburke’s picture

Status: Needs review » Reviewed & tested by the community

Excellent work.

weri’s picture

We had the same problem with the path alias in the described scenario.

I applied and tested the patch. The patch works great and solves the problem.

Thanks for the patch!

cmoad’s picture

Issue summary: View changes

+1 on getting this pushed. We had the same problem.

cristiroma’s picture

Status: Reviewed & tested by the community » Needs work

We found an issue with the following piece of code from the patch:


$conditions['language'] = $node->language;

The problem is that the $node->language is ALWAYS the source language, not the current language. Thus pathauto will break the alias for english language.
Imagine the following scenario

1. Add new node in english (node/42)

url_alias is

481 | node/42 | articles/eeee | en

2. Add translation in romanian using "Add" from Translate tab. The table will look like this

482 | node/42 | articles/eeee | ro
481 | node/42 | articles/eeee | ro

So the english alias is lost., this is because path_load($conditions); will load the english alias instead of romanian one.

The proposed patch is to replace with

      global $language;
      $conditions['language'] = $language->language;

Note: Also having some double-thoughts about running this from command line, like "drush migrate-import" with translations ...

joel_osc’s picture

Not sure what you are saying about the patch, in it I remove the following lines:

-    if ($node->language != LANGUAGE_NONE) {
-      $conditions['language'] = $node->language;
cristiroma’s picture

Status: Needs work » Reviewed & tested by the community

Yes, nevermind, was a little bit tired. Apologies for this mistake.
We just tested your patch and works perfectly :)

  • colan committed 2453ddf on 7.x-1.x authored by joel_osc
    Issue #1946392 by joel_osc: Fix language path alias.
    
colan’s picture

Status: Reviewed & tested by the community » Fixed
colan’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Fixed » Active

Forgot to set this up for forward porting.

das-peter’s picture

Status: Active » Fixed

Does not apply to the 2.x branch, it uses State Machine / State Flow and thus we don't have such code anymore.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.