Closed (fixed)
Project:
Path redirect
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Apr 2008 at 18:48 UTC
Updated:
6 Apr 2009 at 00:10 UTC
Jump to comment: Most recent file
Comments
Comment #1
HorsePunchKid commentedIs there a way to do this programmatically? What are the conventions on having modules set their own weight? It seems like everyone would want their module to be first if it weren't regulated in some way.
Comment #2
sinasalek commentedThere is a module for tweaking weight via admin interface, i didn't use it but i guess that's easier.
And also i think path_redirect module should set its weight less than i18n module when it's installing to become able to catch the urls.
Comment #3
momper commentedhello,
weight 20 i18n - blocks 5.x-2.x-dev
weight 0 i18n - menu 5.x-2.x-dev
weight 0 i18n - profile 5.x-2.x-dev
weight 20 i18n - taxonomy 5.x-2.x-dev
weight 0 i18n - views 5.x-2.x-dev
weight -10 Internationalization 5.x-2.x-dev
weight 0 Menutranslation 5.x-1.x-dev
weight 10 Translation 5.x-2.x-dev
this means concret: ideal weight -11 for path redirect?
sorry - there are a lot of different weights of the i18n modules and i'm a little bit confused ...
greetings momper
Comment #4
sinasalek commentedThe name is exactly "i18n" in name field in Drupal "system" table. but you don't need to be worry about that. give path_redirect -90 for example and you're good to go. path_redirect should be very first module in the list.
Comment #5
momper commentedthanks :)
Comment #6
vacilando commentedDid change the weight of path_redirect to -90 but still it does not work when i18n is on :-((
Comment #7
DrakeRemory commentedOk, I found the solution. The thing is that path_redirect takes the path from $_SERVER['REQUEST_URI'] which contains for example "en/" at the beginning. Because of this there are no matches in the database. So I added these 3 lines in path_redirect.module on line 36:
if (module_exists('i18n')) {
$path = substr($path, 3);
}
There's no need to change the weight.
Hopefully I could help some of you guys.
Comment #8
sinasalek commentedThanks, hope module developer apply it.
Comment #9
wiert commentedfor some languages the language code is longer then 2 so:
if (module_exists('i18n')) {
global $locale;
$len = strlen($locale) + 1;
$path = substr($path, $len);
}
I'm not sure however, whether I can simply use the $locale variable or that I have to pull the $node->language variable out first.
Comment #10
sokopok commentedAnother solution:
In English:
from:
en/content/company
to:
content/company/who
In Dutch:
from
nl/content/bedrijf
to:
content/bedrijf/wie
In Language xxx:
from:
xxx/content/something
to:
content/something-else
Comment #11
2xe commenteda comment to sinasalek and wiert:
Your solutions presuppose prefixed URLs, and not the use of domain names. To make the solution generic you must check how the multilanguage support is implemented.
Comment #12
pivica commentedCode from #9 will not work for drupal 6. Here is a code for d6:
Comment #13
David Lesieur commentedHere's a patch. It has some changes from the above:
Still, there might be a more fundamental problem to be solved in path_redirect: Under D6, URL aliases have a language field, so should the path redirects to avoid ambiguities.
Comment #14
kehan commentedsubscribing
Comment #15
dave reidYou'll need to check out the latest code (6.x-1.0-beta3) which now officially has multilingual support. The code in your patch has been massively changed.
Comment #16
owen barton commentedAs far as I can tell this is fixed in the 6.x branch for a regular i18n setups. Someone with domain on prefix-less setups might want to test also before we close.
Comment #17
dave reidI'm going to mark this as fixed for now. I've had a few people test it on multilingual sites and it works for them. This will not be backported to Drupal 5 as it is feature locked.