Example:

1. Set up a drupal site with English and French (or any other language) enabled.
2. Set the Page content type to synchronize "status" (or any other field) with it's translations.
3. Create a new page, set language to English, and then set Url alias to "testpage". Save.
4. Translate the page you just created, set language to French, and again set the url alias to "testpage". Save.

Result: The url alias for translation is not saved and the path remains "node/2".
Note: If you now go into Admin > Url Aliases, you will notice that there are two entries for "testpage", but they are both pointing to the first node, and they are both set to English.

Here's what is happening. When the second (French) node is saved, the Path module (path_nodeapi) runs this query to save the url alias:

INSERT INTO {url_alias} (src, dst, language) VALUES ('node/2', 'testpage', 'fr')

At this point, *everything is correct* and the url_alias table reflects exactly what we want. Unfortunately, it gets overwritten.

Next, i18nsync does some processing (i18nsync_nodeapi, i18nsync_node_translation) and then calls node_save on the source (English) node. Node save triggers path_nodeapi again which now runs this query:

UPDATE {url_alias} SET src = 'node/1', dst = 'testpage', language = 'en' WHERE dst = 'testpage'

Note that this second undoes the work of the first query. We now have identical rows in the url_alias table for the english node, and none for the french node.

Comments

gnindl’s picture

Title: With i18nsync enabled, a node and its translation cannot have the same url alias. » Support for URL alias synchronization per content type
Category: bug » feature
Status: Active » Needs review
StatusFileSize
new622 bytes

It would be great to have a full support for URL alias synchronization. The only thing we have to add this the option in the node type form (see patch) which get elegantly included as a synchronization field.

There's is another bug in the path module which you have to apply to get it working, see #790338: All aliases get deleted when translatable nodes with same URL alias are reverted to previous revision. The update of URL aliases in the current version of the core is unfortunately language ignorant.

If you use pathauto there's another bug inside this module, see #358722: Node aliases lost/changed when using i18n synchronize translations and comment http://drupal.org/node/358722#comment-3391912.

klonos’s picture

Interesting approach, subscribing...

fmjrey’s picture

Same patch as comment #1 for D6, but in a standard form and relative to module dir instead of drupal dir.

doublejosh’s picture

Came to look if this was a requested feature. Will test.

jose reyero’s picture

Status: Needs review » Postponed

Nothing to do until the core issue is fixed.

doublejosh’s picture

Oh ok. Will listen and perhaps be a resource when if//when it becomes possible.

YK85’s picture

subscribing

robert castelo’s picture

StatusFileSize
new591 bytes

Problem seems to be caused by translation (synchronised node) not having a path ID (pid) value in i18nsync_node_translation().

When the translated node is sent to the path_set_alias() function it's existing path is not detected and it gets an incorrect new path set.

The problem can be fixed in i18sync with the attached patch which adds in the pid before saving the node.

alduya’s picture

Version: 6.x-1.5 » 6.x-1.9
Status: Postponed » Needs review

In my use case (similar to the one explained in the initial post), the patch in #8 solved the problem.

israelshmueli’s picture

subscribing

klonos’s picture

The same procedure described in the issue's description is somewhat different in D7. So, using latest devs of related modules one notices the following things:

- The URL of the translated page is ok after saved (../fr/testpage).
- The two URL aliases ("testpage") both have the correct respective language.
- The French translated alias points to ../en/node/#, still the French URL (../fr/testpage) works just fine when manually typed.

All related issues are against 6.x though and I am lost:

#269877: path_set_alias() doesn't account for same alias in different languages
#358722: Node aliases lost/changed when using i18n synchronize translations
#790338: All aliases get deleted when translatable nodes with same URL alias are reverted to previous revision

So, is there an issue for 7.x I am missing somehow?

jose reyero’s picture

Status: Needs review » Closed (won't fix)

No new features for 6.x

Reopen if you have an upgraded patch for 7.x

robert castelo’s picture

Isn't this a bug fix rather than a new feature?

Any reason not to commit my patch in #8?