Hi,
When a page node is created it will create the page in all the **_node tables. But the **_page will not be synced. It seem quite trival to achieve this and if it isn't on the todo list I'll add it.
What I want to know is who do I contact to coordinate this. You can contact me at [drupal] [at] [jax] [dot] [be].
I'm planning to add code to
[?
function i18n_sync_node_insert($lang,$k,$s,$v){
db_next_id("{node}_nid");
db_query("INSERT INTO {node} (". implode(", ", $k) .") VALUES(". implode(", ", $s) .")", $v);
// todo: if the node is a page sync the **_page tables here
}
?]
If no one contacts me I'll just post the patch here this weekend. Comments always appreciated!
I didn't look any further at the moment due to lack of time. More info coming this weekend.
Comments
Comment #1
jose reyero commentedDo you have the 'page' table in the language dependent table list?
$db_prefix_i18n = array(
'node' => 'drupalco_**_',
'page' => 'drupalco_**_',
........
* This module uses the 'node api' to keep in sync all kind of nodes, but it's up to you to put -or not- the right tables in the list
Cheers
P.S. If this was the problem, please let me know, so we can change the status of this issue to 'closed'
Comment #2
jax commentedHi,
I did add 'page' => '**_' to the $db_prefix_i18n array so that isn't the problem.
[?
$db_prefix_i18n = array (
// '**' will be replaced by language code at runtime.
'node' => '**_',
'page' => '**_',
'term_data' => '**_'
);
?]
This works great for the node content and vocabulary terms. Only the link name and link description is not duplicated in the **_pages tables at creation time.
Comment #3
jax commentedLet me clarify with an example:
If I have a site with two languages 'nl' and 'en'.
In the config I set 'sync nodes'.
When I create a page in the language 'nl' with this setup the title and description will be duplicated in the en_node table.
The entry for that nid will be created in the nl_page table but NOT in the en_page table.
Comment #4
jax commentedOk I got it to work like this:
Added the function in i18n.module
[?
function i18n_sync_page_insert($lang,$k,$s,$v) {
db_query("INSERT INTO {page} (". implode(", ", $k) .") VALUES(". implode(", ", $s) .")", $v);
}
?]
and changed
(line 344 in i18n.module)
[?
// Insert copies for each language
i18n_foreach_lang("sync_node_insert",$k,$s,$v);
break;
?]
to
[?
// Insert copies for each language
i18n_foreach_lang("sync_node_insert",$k,$s,$v);
if($node->type == 'page') {
$k = array('nid', 'link', 'format', 'description');
$v = array(check_query($node->nid), check_query($node->link), check_query($node->format), check_query($node->description));
$s = array("%d", "'%s'", "%d", "'%s'");
i18n_foreach_lang("sync_page_insert",$k,$s,$v);
}
break;
?]
Now it creates the page entries for each language. The way I did it here is probably not the way to do it in Drupal but I'm just starting. And I badly need this functionality for a new site.
Comment #5
jose reyero commentedI think this should be fixed int the 4.5.0 version.
Please, reopen the issue if it is not.
Comment #6
pmark23 commentedThis is the same problem I'm having with 4.5 and i18n. Even after manually syncing the sequences table, they go out of sync as soon as new content is added. The "body" content is missing when switching languages. Is this known to be working with 4.5 now?
Comment #7
jose reyero commentedThis version is not being maintained anymore. Coming 4.5.1 which drops for good this synchronization experimental feature. You can already try cvs version.