Joomla Plug-in simple Image Gallery compatible issue

Recently, my company need to modify WebSite.

Previously, we used Joomla for our site platform, it is very cool CMS, I loved it. Right now, we bought a cool template which include a plug-in from joomlaworks — simple Image Gallery. It is a free extension for adding image galleries inside Joomla! articles.

But we meet a small defect that the tips display not correctly.

Here you will see what’s wrong with the tips:

You may notice JW_SIG_NAVTIP is a very wired description, what we did just add

{gallery}********{/gallery} in our articles, the image display right, but this tip is not what we expected.

First I went to Joomla administration site, in Extensions/Plugin Manager I find Simple Image Gallery (by JoomlaWorks), but there is no parameter setting for this tips issue.

So I have go into code level.

I go through the PHP code, find here is the reason.

In plugins\content\jw_simpleImageGallery\tmpl\Polaroids\default.php

I found  JW_SIG_NAVTIP words,

rel=”lightbox” title=”<?php echo JText::_(‘JW_SIG_NAVTIP’);?> <b><?php echo $row->title; ?></b><br /><br />” target=”_blank”>

JText::_  it means, it should be a string from language config file.

So what I should do is to check the language file, I am using en-GB language which is default setting in Joomla

In plugins\content\jw_simpleImageGallery_1.5.php,

$languageLoad=JPlugin::loadLanguage(‘plg_content_’.$this->plg_name, JPATH_ADMINISTRATOR);

In plugins\content\jw_simpleImageGallery.php, you can find variable plg_name

var $plg_name = “jw_simpleImageGallery”;

So, the language for simple Image Gallery  should be

en-GB.plg_content_jw_simpleImageGallery.ini under

administrator\language\en-GB folder.

I go to the folder, found the file. Open it I found the string I am looking for

JW_SIG_NAVTIP=”<b>Navigation tip:</b> Hover mouse on top of the right or left side of the image to see the next or previous image respectively.<br /><br />You are browsing images from the article:”CLICK TO ENLARGE=”Click to enlarge”

So if everything is right, it should display the “Navigation tip:*******” things, not JW_SIG_NAVTIP. From this I know the language file is not loaded properly.

I found that this plug-in save all strings in one file either for administration setting or site setting. And I do remember that I have go in the  Extensions/Plugin Manager  to check this the strings display correctly. If you like you can compare it by yourself.

And the JPlugin::loadLanguage API should works fine, because I check other plug in which use it. So I think maybe somehow Joomla can not find the language file.

I checked the API in libraries/joomla/plugin/plugin.php

/**
	 * Loads the plugin language file
	 *
	 * @access	public
	 * @param	string 	$extension 	The extension for which a language file should be loaded
	 * @param	string 	$basePath  	The basepath to use
	 * @return	boolean	True, if the file has successfully loaded.
	 * @since	1.5
	 */
	function loadLanguage($extension = '', $basePath = JPATH_BASE)
	{
		if(empty($extension)) {
			$extension = 'plg_'.$this->_type.'_'.$this->_name;
		}

		$lang =& JFactory::getLanguage();
		return $lang->load( strtolower($extension), $basePath);
	}

Notice that “strtolower” call, and the file under language folder is

en-GB.plg_content_jw_simpleImageGallery.ini which contain two upper characters.

For Operation System, the file name maybe case sensitive maybe not. Like, for windows you can configure this sensitive issue.

(http://technet.microsoft.com/en-us/library/cc725747.aspx)

so I tried to change en-GB.plg_content_jw_simpleImageGallery.ini into

en-GB.plg_content_jw_simpleimagegallery.ini

I do not have the change “GB”, since this language prefix it appended in

JLanguage::load() function (libraries/joomla/language/language.php)

which is called by $lang->load( strtolower($extension), $basePath); code.

So I got the expected view for my site.

But for the display of simple image in Extensions/Plugin Manager is missing.

Since in plugins\content\jw_simpleImageGallery.xml is using upper case file, as you can see below

<language tag=”en-GB”>en-GB.plg_content_jw_simpleImageGallery.ini</language>

So we should modify both of it to lower case, so that everything works fine.

But for me, I decide separate back-end and front-end setting.

So I copy en-GB.plg_content_jw_simpleImageGallery.ini as

en-GB.plg_content_jw_simpleimagegallery.ini to language\en-GB folder, be careful, it the not under administrator folder, it should be the path under your site root folder.

So what I have to modify just one line of code

In plugins\content\jw_simpleImageGallery_1.5.php,

From :

$languageLoad=JPlugin::loadLanguage(‘plg_content_’.$this->plg_name, JPATH_ADMINISTRATOR);

To:

$languageLoad=JPlugin::loadLanguage(‘plg_content_’.$this->plg_name)

To make simple image gallery load from site’s language setting not administrator language setting.

Next, if any one wish to modify the tips content, just modify the string value in language file.

Advertisements

3 thoughts on “Joomla Plug-in simple Image Gallery compatible issue

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s