i18nsync says that now we can add more sync fields by adding appropriate strings to settings.php:

// Available fields for synchronization, for all node types.
$conf['i18nsync_fields_node'] = array(
  'field1' => t('Field 1 name'),
  'field2' => t('Field 2 name'),
  ...
); 

I wonder if this trick can be used to synchronize node URL's across translations, so that all translations would just inherit the original node's path alias, and the URL's would differ only with their language prefixes?
Thank you!

Comments

lightnin’s picture

How I long for this feature! Perhaps it could be done with pathauto, using a token that reference's the original untranslated node's path?

subscribe...

GN’s picture

see http://drupal.org/node/533254#comment-2472244 by fm_jay
He suggests using in tokenSTARTER

<?php
$values['tnid'] = $object->tnid;
?>

I have just tested it.
It seems to work – but, as I actually expected, it requires reopening and resaving nodes after translation:
when you create an original node and save it, first you get [tnid]=0; then, if you open it and save again, you get [tnid]=nid;
and when you create a translation and save it for the first time, [tnid]=0 – you need to open and save it again with an automatic URL alias to get [tnid]=tnid.

Update:
dereine suggests using the following code:

<?php
$values['tnid'] = $object->tnid ? $object->tnid : $object->nid;
?>

It works better - now [tnid] is first set to nid instead of 0, so that we need to reopen and resave only the translation to get [tnid]=tnid instead of the second nid.

lightnin’s picture

Interesting! Thanks for the help. Where exactly should I put this code? In settings.php, like so?

// Available fields for synchronization, for all node types.
$conf['i18nsync_fields_node'] = array(
$values['tnid'] = $object->tnid ? $object->tnid : $object->nid
);

Upon testing this, I receive this message when saving the translated nod:
warning: unlink(sites/default/files/languages/fr_1ee30e38f785a8bf1f624a323a678680.js) [function.unlink]: Permission denied in /usr/share/drupal6/includes/file.inc on line 435.

jose reyero’s picture

Component: Code » Blocks
Status: Active » Closed (won't fix)

No patch so far. And no new features for 6.x