The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Feb 01, 2012 12:08 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Aug 17, 2009 10:58 am
Posts: 5
Hi,

Im stuck, we have a site that is translated into 10 different languages at the moment and is live on Joomla 1.7.4. Our issue is we would like to add 3 more language options to the language switcher but can only be see by registered users. i.e. public users will not be able to see the new languages in the switcher. We need this for development reasons as we have no way of seeing how the pages look like on the site without the general public seeing them aswell.

P.S. I remember Joomfish had this option of assigning user levels to languages, allowing our web designers to work on ans see the hidden languages before pushing them live.

Cheers


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 3:44 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17327
Location: **Translation Matters**
I am afraid the only solution at this stage would be to code a new mod_languages looking for the Access level of the specific language home page and the User Group of the user.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Mon Feb 06, 2012 10:32 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Aug 17, 2009 10:58 am
Posts: 5
That is a real shame. Are there any plans to implement this into future releases of Joomla? I think this is the only thing that is missing from the multilingual functionality of Joomla core. The ability to have user level selection on languages in the language manager would solve this issue all together.


Top
 Profile  
 
PostPosted: Mon Feb 06, 2012 3:36 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17327
Location: **Translation Matters**
There are no plans but anyone may propose a patch.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Tue Feb 21, 2012 8:55 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17327
Location: **Translation Matters**
Update:
This feature is now implemented in trunk and will be available in 2.5.2

See: http://joomlacode.org/gf/project/joomla ... m_id=28036

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Wed Mar 07, 2012 2:42 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Apr 15, 2010 9:26 pm
Posts: 1
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:
<?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:
   <?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:
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. :D

Richard


Top
 Profile  
 
PostPosted: Wed Mar 07, 2012 4:58 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 17327
Location: **Translation Matters**
It is not advised to hack core.
If one wants to change the default.php, better do it in an override in the template.

Also, this looks extremely complex as full Access control is now in trunk and will be available with 2.5.3 (2.5.2 was a security release i.e. a 2.5.1 + the correction of the vulnerabilities.)

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 



Who is online

Users browsing this forum: Google Adsense [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group