JoomFish / joomfish-2.5

Joom!Fish 2.5 core development
http://www.joomfish.net/
34 stars 27 forks source link

Router issues: when translating menu items #55

Closed quodo closed 12 years ago

quodo commented 12 years ago

I experience some issues with the router. It seems that the menu alias of the default language is used which means that contents for a menu item that is translated is not found (?).

With Joomla's sample data there is a frontend menu "About Joomla" with an entry "Using Joomla!". I've translated this "Using Joomla!" menu item a second language dutch (nl-NL). I've made it easy:

When I go in the frontend to to this menu item in the original language I go to http://localhost/index.php/en/using-joomla With the language selector I want to go to the the dutch translation, it directs me to the link http://localhost/joomla_development/joomla25joomfish/index.php/nl/component/content/?Itemid=280 resulting in the wrong contents (it's all about articled here, sampla Data Articles, Joomla articles, Extenstions, etc., this is not where I should've been directed).

New try: Start on the home page, then set the language selector to dutch, then go to the "Using Joomla! NL" (dutch) menu item: http://localhost/index.php/nl/using-joomla-nl If I now go to the english (en-GB, default) language this is the link http://localhost/index.php/en/using-joomla-nl However, this page does not exist: "An error has occurred. The requested page cannot be found. (...) #404 Category not found".

Notice that here the dutch alias is used but with the english language.

For a third language where this menu item is not translated this works ok: http://localhost/index.php/de/using-joomla.

Joomla 2.5.3, PHP 5.2.9, MySQL 5.1.33, Mozilla Firefox JoomFish jf-future with latest commit 4821ac0

klas commented 12 years ago

Menu translation issue caused by id replacements breaking menu trees, we need to translate trees by item and replace only translatable values.

Also we need to make sure reverse happens when sef urls are decoded - urls need to be translated back to default language before they are decoded.

With commit 02f34a9015 things should be in workable state again (the above url segments translations remain to be implemented)

klas commented 12 years ago

Menu re-routing works now in both ways (original to translated and back), part that remains to be fixed is translation of items appended to the url (e.g. when drilling down to item from category blog).

quodo commented 12 years ago

Solved indeed! Thanks!

With the setup described in the original post, it now works: english: .../index.php/en/using-joomla dutch (nl-NL): .../index.php/nl/using-joomla-nl untranslated contents for german (de-DE): http://localhost/joomla_development/joomla25joomfish/index.php/de/using-joomla All three as expected.

Also, the correct aliases are used and the breadcrumbs (issue #44) work ok.

Klas wrote

part that remains to be fixed is translation of items appended to the url (e.g. when drilling down to item from category blog).

This I didn't try...

mouttaqui commented 12 years ago

I made some change in plugins / system / jfoverrides / classes / menu.php

this : if ($item->language != '*' && $item->language != JoomFishManager::getInstance()->getDefaultLanguage() ) {

By this : if ($item->language != '*' && $item->language != $jlanguage ) {

and it works for me

Can you tell me if it solves the problem for you or not

klas commented 12 years ago

Hi @mouttaqui , issue should be already resolved in latest revision in different way. We are removing non-default items at that point (set either to * or defualt language) to prevent confusion in the router at alter stages as otherwise we get double menu trees and multiple items with the same aliases after original items get translated, so, while your change might temporary fix an issue for you it does not fit the purpose of this code.

mouttaqui commented 12 years ago

Hi @klas

You should know that your proposed solution excludes the Selected menu language if it is not the language by default, and then change the language you come across pages 404

klas commented 12 years ago

404 are still happening, but that is different issue - issue here is about wrong URL's produced andthis is fixed now. For the remaining issue with 404's showing when some of those links get clicked I opened new issue, see #57