Welcome to Geeklog Tuesday, December 12 2017 @ 09:01 am EST


Status: offline

Roccivic

Forum User
Moderator
Registered: 19/05/2010
Posts: 136
After creating a language selection block (http://www.geeklog.net/forum/viewtopic.php?showtopic=93460) a few days ago, I've noticed that several community members were interested in it despite it's limitations. So I decided to improve on that effort and create a proper language selection plugin.

This plugin provides a dynamic block that allows both anonymous and logged-in users to switch language on the fly, with or without JavaScript. The position and order of the block are customisable via the Geeklog configuration UI.

Download: http://code.google.com/p/geeklog/downloads/detail?name=langsel_1.0.0_1.8.0.tar.gz
Alternative download: http://www.geeklog.net/filemgmt/index.php/1072
Or clone: hg clone https://code.google.com/p/geeklog.langsel/

Feedback, patches and new translations are, as always, welcome.

Enjoy,
Rouslan

cesar

Anonymous
It's running
thanks again
you also can use it in spanish
PHP Formatted Code
<?php

/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Language Selection Block Plugin 1.0.0                                     |
// +---------------------------------------------------------------------------+
// | english.php                                                               |
// |                                                                           |
// | English language file                                                     |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2011 by the following authors:                              |
// |                                                                           |
// | Authors: Rouslan Placella - rouslan AT placella DOT com                   |
// +---------------------------------------------------------------------------+
// | Created with the Geeklog Plugin Toolkit.                                  |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+

/**
* @package LanguageSelectionBlock
*/


$LANG_LANGSEL_1 = array(
    'plugin_name' => 'Bloque Selección de Idioma',
    'conf_link'   => 'Configuración',
        'title'       => 'Selecciona idioma',
        'submit'      => 'Ir'
);

// Localization of the Admin Configuration UI
$LANG_configsections['langsel'] = array(
    'label' => 'Bloque Selección de Idioma',
    'title' => 'Configuración del bloque de Selección de Idioma'
);

$LANG_confignames['langsel'] = array(
    'block_pos' => 'Lugar donde se mostrará el bloque',
    'block_order' => 'Orden del bloque',
);

$LANG_configsubgroups['langsel'] = array(
    'sg_main' => 'Ajustes principales'
);

$LANG_tab['langsel'] = array(
    'tab_main' => 'Ajustes principales del bloque de selección de idioma'
);

$LANG_fs['langsel'] = array(
    'fs_main' => 'Ajustes principales del bloque de selección de idioma'
);

$LANG_configselects['langsel'] = array(
    1 => array('Izquierda' => 1, 'Derecha' => 0)
);

?>
 

Status: offline

Roccivic

Forum User
Moderator
Registered: 19/05/2010
Posts: 136
Thanks for the translation. It's merged into the repository.

Rouslan

cesar

Anonymous
Now, one problem again. Is posible that this block shows only in front page?

César

Anonymous
Now, one problem again. Is posible that this block shows only in front page?

Status: offline

Roccivic

Forum User
Moderator
Registered: 19/05/2010
Posts: 136
This is completely untested, but should work.
Add the part highlighted in red into the relevant place into functions.inc of the language selection plugin:

function plugin_getBlocks_langsel($side, $topic='' )
{
global $_USER, $_CONF, $_LANGSEL_CONF, $LANG_LANGSEL_1, $_SCRIPTS;

$retval = array();

if (! COM_onFrontpage()) {
return $retval;
}


// check if we need to show the block
if (($side=='left' && $_LANGSEL_CONF['block_pos'] == 1) || ($side=='right' && $_LANGSEL_CONF['block_pos'] == 0)) {
$_SCRIPTS->setJavascriptLibrary('jquery' );
if ($_USER['uid'] <= 1) {
// For anonymous users

César

Anonymous
It's working.
Thanks for all

All times are EST. The time is now 09:01 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content