Hi chirwad
Here's how I filter languages, using the my Language dropdown module hack on J1.7
Backup, Backup, Backup the file default.php in the /modules/mod_languages/tmpl/
I've stripped out the fancy versions of this menu, it only works with a drop down list.
Replace code with the following:
Code: Select all
<?php
/**
* @version $Id: default.php 22372 2011-11-09 16:47:59Z github_bot $
* @package Joomla.Site
* @subpackage mod_languages
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
JHtml::_('stylesheet', 'mod_languages/template.css', array(), true);
?>
<div class="mod-languages<?php echo $moduleclass_sfx ?>">
<?php if ($headerText) : ?>
<div class="pretext"><p><?php echo $headerText; ?></p></div>
<?php endif; ?>
<?php if ($params->get('dropdown',1)) : ?>
<form name="lang" method="post" action="">
<select class="inputbox" onchange="document.location.replace(this.value);" >
<?php
$filterOutKeys = array( '5' );
$filteredArr = array_diff_key( $list, array_flip( $filterOutKeys ) );
print_r($filteredArr);
?>
<?php foreach($filteredArr as $language):?>
<option dir=<?php echo JLanguage::getInstance($language->lang_code)->isRTL() ? '"rtl"' : '"ltr"'?> value="<?php echo $language->link;?>" <?php echo $language->active ? 'selected="selected"' : ''?>>
<?php echo $language->title_native;?></option>
<?php endforeach; ?>
</select>
</form>
<?php endif; ?>
</div>
At the end you can add a manual redirect to another site if needed ( add lines of code after the "<?php endforeach; ?>"
Code: Select all
<?php endforeach; ?>
<option value="http://www.example.fr">Français</option>
<option value="http://www.example.it/">Italiano</option>
</select>
</form>
<?php endif; ?>
</div>
Make the language content live in the control panel then check the source code of the page to get the Array ID of the language you want to remove.
Example below: Array ID is "[0] =>".
Code: Select all
Array
(
[0] => stdClass Object
(
[lang_id] => 2
[lang_code] => de-DE
[title] => German
[title_native] => German
[sef] => de
[image] => de
[description] =>
[metakey] =>
[metadesc] =>
[sitename] =>
[published] => 1
[ordering] => 0
[active] => 1
[link] => /index.php/de/
)
[1] => stdClass Object
(
[lang_id] => 1
[lang_code] => en-GB
[title] => English (UK)
[title_native] => English (UK)
[sef] => en
[image] => en
[description] =>
[metakey] =>
[metadesc] =>
[sitename] =>
[published] => 1
[ordering] => 1
[active] =>
[link] => /index.php/en/
)
[2] => stdClass Object
(
[lang_id] => 3
[lang_code] => it-IT
[title] => Italian (IT)
[title_native] => Italian (IT)
[sef] => it
[image] => it
[description] =>
[metakey] =>
[metadesc] =>
[sitename] =>
[published] => 1
[ordering] => 1
[active] =>
[link] => /index.php/it/
)
)
Add this array ID to line 23:-
$filterOutKeys = array( '0', '2');
This would remove German (0) and Italian (2) from the drop down menu.
Once you have the ID's remove line 25 "print_r($filteredArr);" This just prints the Array so you can grab the ID.
So what happens? Well it just simply removes the language(s) from the drop down list. Then it's up to you how you manage the site, I would suggest that you set the homepage to public access level in the menu manager for the hidden c, add a coming soon message on the landing page, with a link back to a live language. Then set all other menu & pages items to higher users levels (Registered or Higher).
You could make the language(s) landing page (Public) all other menu/page (Registered) without the hack if you wanted, but I prefer to hide the unready languages in the drop down menu until ready.
You can then log into the frontend as a registered user and see all the content for the hidden languages by just adding your country code to the URL:
index.php/it/
index.php/de/
Make your you switch back to a visible languages before leaving the site as the cookies might cause you issues.
When your ready to go live, replace the default.php with your original file.
Note: Recheck Array ID when you add new languages it might well change!
It's not pretty but it works.
Richard