Lets say I have 2 exactly same Views except they have different path, one uses node/search and the other node/recherche (french). Using Pathauto I forward these 2 links to these location
node/search = house/search.html
node/recherche = maison/recherche.html
Lets say my current page is the english one, Localizer block will display this link "switchuilocale/fr?destination=house/search.html" while in fact I would need this link "switchuilocale/fr?destination=maison/recherche.html"
What I had in mind shouldn't be pretty hard to code, I was able to do it in a crappy php way, but I am sure someone with more drupal knowledge than me could make a module for Localizer which would enable a way to set some of Pathauto link to a specified language, same way as with nodes.
I added a table with the same structure as localizernode called localizerpath, the 3 columns were renamed to (pid, locale, dst) instead of (pid, locale, nid)
localizerpath content
329, fr, 330
330, en, 330
Now my solution, which works but is not drupal-ok and this is why I need someone with this issue:
localizer.module line 448 (before $destination is url-encoded):
$result = db_query("SELECT s.pid AS src_pid, t.locale AS locale, t.dst AS dst_pid FROM {url_alias} s LEFT JOIN {localizerpath} t ON t.pid = s.pid WHERE s.dst='%s'", $destination);
// ORIGINAL FOUND
if ($original = db_fetch_object($result)) {
if (!empty($original)) {
$result = db_query("SELECT * FROM {localizerpath} WHERE dst='%d' AND locale='%s'", $original->dst_pid, $lang);
// TRANSLATION FOUND
if ($trans = db_fetch_object($result)) {
if (!empty($trans)) {
$result = db_query("SELECT * FROM {url_alias} WHERE pid='%d'", $trans->pid);
// TRANSLATION DATA RETREIVED
if ($trans_data = db_fetch_object($result)) {
if (!empty($trans_data)) {
$destination = $trans_data->dst;
}
}
}
}
}
}
If anyone wants to help me with that I would appreciate.
Comments
Comment #1
mediamash commentedanyone for this one?
Comment #2
rhache commentedI'm not sure if this helps you, but you may look at the small module for localizer/pathauto in this feature request I just posted.
The module allows you to use language as a pathauto variable.
Rene
Comment #3
weedoo commentedI still use this technique, here is the updated function. Old version needed the original alias. This one uses internal paths. Just take