? Success

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
29 Jan 2016

Description

This PR takes similar languages associations code from language filter, mod languages and some helpers and centralize it in JLanguageAssociations.
It also ...

Does some improvements

The components without menu item id now will have an alternate language association too.
For instance, the if current URI is a component without menu item (ex: /en/component/users/), the associated language URI will be the version of the component page in the other language (ex: /fr/component/users/).

Corrects some bugs
  1. If you have 2 languages (published and public) but one was the home menu item id with a higher view level. It shouldn't appear in the language meta tags nor in mod languages flags/text.
  2. If you have 2 languages (published and public) and the 2 home item menus (also published and public) but the language ini folder/file does not exist. It shouldn't appear in the language filter nor in mod languages flags/text.
Performance

Also there is a very slight performance improvement in a multilanguage site, because the language switcher and the language filter plugin now use the same method to get the languages associations, instead of doing that two times in each page.

New method JLanguageMultilang::getAvailableLanguages()

Besides the new methods in JLanguageAssociations, this introduces a new method JLanguageMultilang::getAvailableLanguages() that is different from the JLanguageHelper::getLanguages().

JLanguageHelper::getLanguages() only gets the content languages that are published.

JLanguageMultilang::getAvailableLanguages() uses JLanguageHelper::getLanguages() to get the content languages published and them does some checks to check if that language is really available to the user, it checks:

  • if the language extension exists and is enabled. Though JLanguageMultilang::getSiteLangs()
  • if the user has view level rights to that published language
  • if the language has a published homepage. Though JLanguageMultilang::getSiteHomePages()
  • if the user has view level rights to that published homepage
  • if there is a ini file for that language

And also returns the language object with the language menu item homepage id.

See https://github.com/andrepereiradasilva/joomla-cms/blob/language-association-improvement/libraries/cms/language/multilang.php#L136-L176

How to test

  1. Install latest staging with multilanguage. Language filter on, 2 or more languages with language homepages and language switcher module on.
  2. Install this patch.
  3. Make some language associations.
  4. Test language associations with or without language published, different view levels, etc. Also, different language filter plugin options. Check if the language switcher and the alternate meta code in the head are as they should.
  5. Check if bugs described above are corrected.
  6. Check if component without menu items now have the language association (ex: /en/component/users/).

Observations

Improvements, suggestions and code revisions are welcome.

@infograf768, please check this one, when you have time.

avatar andrepereiradasilva andrepereiradasilva - open - 29 Jan 2016
avatar andrepereiradasilva andrepereiradasilva - change - 29 Jan 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 29 Jan 2016
Labels Added: ?
avatar andrepereiradasilva andrepereiradasilva - change - 29 Jan 2016
The description was changed
avatar infograf768
infograf768 - comment - 30 Jan 2016

This is a huge change. Please remind me after 3.5.0 release.

avatar brianteeman brianteeman - change - 30 Jan 2016
Category Multilanguage
avatar andrepereiradasilva
andrepereiradasilva - comment - 30 Jan 2016

Sure, i understnd that 3.5 is a priority for now and IMHO this should only go for 3.6.
Yes, it's a big change, because language switcher and mod_languages are now essencialy repeating the same process to get the language associations. Almost all changes are in the language associations meta tags in the language filter and in the language switcher that are now centralized in the language associations library, and, with that, reducing the code in mod_languages helper and language filter afterdispatch to minimum.

For less confusion and simpler tests, i did have some caution to not change the language filter behaviour itself.

avatar brianteeman brianteeman - change - 20 Mar 2016
Milestone Added:
avatar brianteeman
brianteeman - comment - 8 May 2016

@infograf768 reminding you of this as requested


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9023.

avatar brianteeman brianteeman - change - 8 May 2016
Milestone Removed:
avatar joomla-cms-bot joomla-cms-bot - change - 8 May 2016
Milestone Removed:
avatar infograf768
infograf768 - comment - 8 May 2016

i know. andre and i decide we look deeper into this for 3.7

avatar andrepereiradasilva
andrepereiradasilva - comment - 8 May 2016

yeah you can put the 3.7.0 label on this one

avatar brianteeman brianteeman - change - 8 May 2016
Milestone Added:
avatar brianteeman
brianteeman - comment - 3 Aug 2016

@infograf768 @andrepereiradasilva Is this ready for testing now?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9023.

avatar andrepereiradasilva
andrepereiradasilva - comment - 3 Aug 2016

no, will close this.

avatar joomla-cms-bot joomla-cms-bot - change - 3 Aug 2016
Category Multilanguage Administration Components Libraries Front End Modules Plugins Multilanguage
avatar andrepereiradasilva andrepereiradasilva - change - 3 Aug 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-08-03 14:32:40
Closed_By andrepereiradasilva
avatar andrepereiradasilva andrepereiradasilva - close - 3 Aug 2016

Add a Comment

Login with GitHub to post a comment