Hi,
I installed a fresh Drupal 4.7 version, together with the i18n cvs version, but some things don't seem to work properly.
For example i have /node/1/ being the english version, and /node/2/ being the czech version.
In the translation block the links link to 'en/node/1/' in the english link, and to 'cs/node/2/' in the czech link. So this works ok.
But i also added an URL alias for both links (different for each), but the links to the nodes don't use this url alias, but the standard /node/x/ instead...
Would it be possible to have this behaviour anyhow?
P.S.: Is it normal that i can't translate menu items through the locale system? I thought the previous version of i18n (4.6) allowed this... Maybe i'm wrong...
Comments
Comment #1
Marc Bijl commentedSame problem here...
In the 4.6 version, AFAIK (hope I'm correct now...), this didn't work either. At least, I had the same problems with URL aliasing; see these posts:
- http://drupal.org/node/32144
- http://drupal.org/node/34611
To solve translation of URL aliasing, in 4.6.6 I've always used this patch - with success:
- http://drupal.org/node/22345
The code needed to be patched against i18n.inc. However, the function where it was all about (i18n_l) became part of translation.module and got another name (translation_url). I've tried to patch the same code in the renamed function in translation.module, and really, something is happening with the URL's in the translation block, but it still isn't what I want.
Although I'm not a programmer, I'll look further. In the meantime, I hope this info might be a good starting point for others to help solving this issue...
Cheers,
Marc
Comment #2
svendecabooterThanks for pointing to the translation_url method.
I tried applying your patch there too, and it does indeed something to the URLs, but it doesn't quite work yet:
I get the following urls:
http://www.website.com/en/en/about_new_media
http://www.website.com/cs/en/co_jsou_nova_media
It seems that an extra '/en/' gets added, which leads to the fact that urls don't work... Now i'm gonna try to find out what causes this extra 'en' and get rid of it if possible...
Comment #3
svendecabooterAnother remark: The above urls are only generated in the 'Translations' block.
In the normal menu i have, only the language prefix changes, but the path not, it stays the english path
But maybe i set up something wrong there, so i still gotta figure that out.
Comment #4
Marc Bijl commentedConfirmation of exactly the same experience here.
Comment #5
jose reyero commentedI've changed the path processing to check always for path aliases before appending the language prefix.
Comment #6
Marc Bijl commentedHi Jose,
Thanks very much mate, for repairing: it works pretty good now!!!
However, there's one error that keeps coming back (e.g. here and now, when testing the alias in language translation block and therefore switching and switching and switching), and that's the error:
If you do a "delete from cache", it's fine again, but within a few clicks, the error comes back. Hope this explanation makes some sense...
Comment #7
Marc Bijl commentedSome additional info:
I get this error message also when I'm clicking through the primary links, AFAICS exactly then when I come back to a certain menu item for the second time.
Comment #8
Marc Bijl commentedSo it seems it has something to do with rebuilding a full path, including alias, for a second time; whether it's a primary link or a link in the language translation block.
I can remember, to get i18n menu module working, a
cache_clear_all($cid);was needed somewhere; maybe it's the same kind of issue? Or is it just the "undefined function" as the error says?Comment #9
jose reyero commentedYes, there was a problem with the bootstrap when cache enabled. It should work now.
Comment #10
Marc Bijl commentedSorry Jose, for making active again... :\
Thanks for the efforts anyway, in the middle of the night! You're mad... The error message is gone, so that's the good news! However, there's a little bit of bad news too.
Everything is fine when English and Dutch url aliases are based on different words - because they're different in these two languages:
Here, the links become respectively "en-US/advertising" and "nl/adverteren" which is good.
Things go wrong when English and Dutch url aliases are based on the same words - because they're the same in these two languages (and therefore need to get e.g. an additional language prefix in their url aliases in order to make them different and unique):
Here, the links become respectively "en-US/en-US/advertising" and "nl/nl/adverteren" which isn't good.
In 4.6.6 I got this thing working with a patch that can be found here: http://drupal.org/node/22345. This resulted in the following i18n.inc for 4.6.6 which AFAICS did the trick for me:
I tried to patch function translation_url in translation.module 4.7 the same way (I suppose the function translation_url in translation.module 4.7 can be compared to the function i18n_l in i18n.inc 4.6?), however, this didn't work...
Wish I had some more programming skills, so I could help solving this little issues. Anyway, hope this all makes some sense and creates a good starting point for anyone with better skills...
Comment #11
jose reyero commentedHi again. I've reworked the path rewriting to handle a lot more cases.
You mark this as 'fixed' if you finally like it ;-)
Comment #12
Marc Bijl commentedHi Jose, thanks again!
I'm not in the position to test right now, but I will certainly do tomorrow.
Thumbs up,
keep up the good work!
Marc
Comment #13
Marc Bijl commentedHi Jose,
Managed to test the latest cvs version from here (at my girlfriend's :)) and everything in translation block works like a charm now; excellent work, many thanks!
Marc
Comment #14
jose reyero commented