if I have pathalias enabled, and use aliases for taxonomies (at least, this is my case, maybe it works on some other pages too) the language block dosn't use the right (aliased) URL for the 'translated' link, it instead just changes the language code, resulting in a 'not found' page :-(

i propose to modify i18n_l() in i18n.inc to de-alias the url before translating it, and then re-alias it after having the translation:

(starting from line 227

  // If url has lang_prefix, remove it
  i18n_get_lang_prefix($url, true);

+  // If url is an alias, de-alias it
+  $url = i18n_get_normal_path($url);

[...]

+  // If url has an alias, use it!
+  $url = drupal_get_path_alias($url);

return '<a href="'. [...]

Comments

Marc Bijl’s picture

Category: feature » bug
Status: Active » Needs review

This patch rocks!

I've been looking for ages for a solution like this, see also:
- http://drupal.org/node/32144
- http://drupal.org/node/34611

It works for me, for node aliases at least. Excellent stuff!

Changed status to "code needs review", hope this can be committed soon...

igrcic’s picture

ok i got a case like this:
1) upgraded to drupal v4.6.5
2)put newest i18n.module (together with i18nmenu and i18nblocks modules)
3) took patched taxonomy.module, common.inc and bootstrap.inc from http://cvs.drupal.org/viewcvs/drupal/contributions/sandbox/jareyero/modu...

now...created one node (page), and also created translation for it. in languages block it is showing right path to its versions. so i have en/node/100 when i click on eng flag and hr/node/101 when i click on my country flag.

so it works without this patch of yours, for nodes.

then patched i18n.inc (added those 2 lines).
then when i click on page category/taxonomy of that page, the links in language block again shows the same taxonomy number just change the language so its en/taxonomy/term/100 and hr/taxnomoy/term/100, insted of term/101.

so this patch doesnt work for me!!

_tag_@zibarda.m... it is working for your site? u get two different taxonomy/term in language blocks? could u post ur i18n.module and i18n.inc?

igrcic’s picture

forgot to say, its the same using aliases or not!

igrcic’s picture

..me again :)

im also using ur sub modules i18n_menu and i18n_block, and i think that problem with taxonomies should be solved on a similar way as with blocks! to create multilingual block, and then select block for each language! so there should be some link that would connect two taxonomies, so that when you change language, taxonomy link in language block doesnt change from en/taxonomy/term/X to es/taxonomy/term/X but to es/taxonomy/term/Y where X and Y are connected in some way. anybody else thinks like taht also?

Moxide’s picture

Hi,

I've just tested this patch on a Drupal 4.6.5 install, which suffered from the 'wrong aliases' problem.

It worked like a charm !

Thanks :-)

igrcic’s picture

i forgot to say... i dont need to use patch! it works without it with newset version of i18n module! all you need to do is make new translation under categories!

igrcic’s picture

well installed http://drupal.org/node/22834 and same stuff is happening all over again....

dont know what to do anymore...

igrcic’s picture

please, can anyone confirm that i18n is working together with TAC module? i got it all working except this issue!!

tnx

jose reyero’s picture

Status: Needs review » Closed (won't fix)

This version is not supported anymore. Please upgrade your Drupal installation.