[ic] Changing the mv_locale

Stefan Hornburg racke at linuxia.de
Sat Sep 27 13:13:33 EDT 2003


On Sat, 27 Sep 2003 10:35:15 +0200
"Xavier GILLET" <xavier.gillet.perso at wanadoo.fr> wrote:

> Hi,
> 
> I'm running a catalog with two versions (french and english).
> The default is french.
> I'm looking a code to reload each page changing the locale.
> 
> something like [page @@[email protected]@] but changing the locale when the page is
> reloaded (fr_FR if mv_locale is en_EN, en_EN if mv_locale is fr_FR).
> 
> Thanks for help.

You can try something like that:

UserTag languagebar Routine <<EOR
sub {
	my ($page, $arg, $lang, $url, $bar);
	my $lurl = $Session->{last_url};

	$lurl =~ s%/process/locale/.*?/page%%;
	$lurl =~ s/\.(de|en)\.html$/.html/;

	# special case for the flypage
	$page = $Tag->var('MV_PAGE', 1);
	$arg = '';
	if ($page eq $Config->{Special}->{flypage}) {
		$arg = $Scratch->{arg};
	}	

	my @langs = ('de_DE', 'en_US');

	for (@langs) {
		$lang = substr($_, 0, 2);
		$url = $Tag->area({href=>"process/locale/$_/page$lurl",
					 	  secure=>$Scratch->{secure},
					   	  arg => $arg
						  });

		$bar .= <<EOB;
<a href="$url"><img alt="" width=36 height=18 border="0" src="$Variable->{IMAGE_DIR}/lang/$lang.gif"></a>
EOB
	}

	return $bar;
}
EOR

Ciao
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list