1

I have a content node in 2 languages. When I use the language switcher while displaying the English content:

www.example.com/en/content/Article-on-relativity

it displays correctly the translated content in Spanish in this URL

www.example.com/es/content/Articulo-sobre-relatividad

However, when I include the contents filtered in a View, the language switcher only swiths the first part of the URL, but not the alias URL of the content itself, displaying Not Found

www.example.com/en/myView/Article-on-relativity

changes to

www.example.com/es/miVista/Article-on-relativity

instead of the desired

www.example.com/es/miVista/Articulo-sobre-relatividad

Thanks!!!

0

An alternative would be to use i18n_page_views module - it is a display plugin that installs an item labeled i18n page into the +Add (display) button menu. It's like a page display extended by fields for entering a path for each enabled language.

While it does not offer any tool to convert existing displays into i18_page type, it's quite easy to do that manually - just export your existing view(s), change the type of the display in a notepad and re-import w/override.

Regretfully, the module does not offer UI for creating translated menu items - this also has to be done manually.

At any rate, it's advisable to bind all translation paths (created manually as jdu suggested, or created automatically) into a translation path set (admin/config/regional/i18n_translation/path/add). I found that without it the i18n_get_path_translations function worked whimsically.

  • I had to do this finally: foreach($links as $lang => $url_arr){ $content_arr = explode("/", $url_arr["href"]); $content = $content_arr[2]; $node_id = drupal_lookup_path('source', 'content/' . $content); $translations = translation_path_get_translations($node_id); $translation = drupal_get_path_alias($translations[$lang], $lang); $translation_arr = explode("/", $translation); $string = ""; for($i=0;$i<count($content_arr)-1;$i++){ $string .= $content_arr[$i] . "/"; } // for $string .= $translation_arr[1]; $links[$lang]["href"] = $string; } – Cesar Nov 20 '14 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.