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.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | i18n-i18nsync-url-alias-sync-897850-8.patch | 591 bytes | robert castelo |
| #3 | i18n-i18nsync-url-alias-sync-897850-3.patch | 1.04 KB | fmjrey |
| #1 | i18nsync-url-alias-sync.patch | 622 bytes | gnindl |
Comments
Comment #1
gnindl commentedIt 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.
Comment #2
klonosInteresting approach, subscribing...
Comment #3
fmjrey commentedSame patch as comment #1 for D6, but in a standard form and relative to module dir instead of drupal dir.
Comment #4
doublejosh commentedCame to look if this was a requested feature. Will test.
Comment #5
jose reyero commentedNothing to do until the core issue is fixed.
Comment #6
doublejosh commentedOh ok. Will listen and perhaps be a resource when if//when it becomes possible.
Comment #7
YK85 commentedsubscribing
Comment #8
robert castelo commentedProblem 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.
Comment #9
alduya commentedIn my use case (similar to the one explained in the initial post), the patch in #8 solved the problem.
Comment #10
israelshmueli commentedsubscribing
Comment #11
klonosThe 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?
Comment #12
jose reyero commentedNo new features for 6.x
Reopen if you have an upgraded patch for 7.x
Comment #13
robert castelo commentedIsn't this a bug fix rather than a new feature?
Any reason not to commit my patch in #8?