Page 1 of 1

Multilingual footers and other common content

Posted: Sun May 28, 2006 7:18 pm
by Der Rudi
Please also see my last post in this topic!

Multilingual footers and other common content

when using the multilingual hack by katon (good work btw), I needed a way to select footers based on the language selected. Since this was not included I decided to have a go at this myself. This is what I got to:

1. define a new User Defined Tag (ie multilingual_footer) with the following code:
$l=$_GET['lan'];
switch ($l):
case 'nl':
   echo 'Dutch footer goes here';
   break;
case 'en':
   echo 'English footer goes here';
   break;
default:
   echo 'Default footer goes here';
endswitch;

2. change the Global Content Block 'footer' to include (can be the only entry in this Block):
{multilingual_footer}

3. also add the following in template_config.php (around line 43) for more xhtml compliant code (add ALT text and close IMG tag):
"en" => '',
"nl" => ''
etc.

And you are done!

The same setup can be used for other common language dependent data also, like Meta Data. One should then not use the default {metadata} tag in the template used, but the newly defined User Tag for this to work. I know, it is not pretty, but it works!

If anyone has some other ideas or suggestions, please do :)

Re: Multilingual footers and other common content

Posted: Wed May 31, 2006 9:46 pm
by sparky
That's a good idea.

I have a question and perhaps you can help me out. In my multilingual CMSMS by Katon the breadcrumb and selflink (next page/previous page) navigation always leads to my default language page since the language suffix (e.g. &lan=en) is not added to the url. If my explanation is not clear then please check http://www.zafrans.de. Do you have any solution for that?

Thanks!

Re: Multilingual footers and other common content

Posted: Wed Jun 07, 2006 2:13 pm
by Der Rudi
No, sorry no solution for that. Have the same problem myself also.

Anyone else with bright ideas?

Re: Multilingual footers and other common content

Posted: Sat Jun 10, 2006 11:56 am
by Der Rudi
Ok, this is what did the trick for me:

1) defined UDT as follows:

global $gCms;
$pg_alias=$gCms->variables['page_name'];

$l=$_GET['lan'];
if ($l==false) $l='en'; //default when no language selected
switch ($l):
case 'nl':
   echo 'Some Dutch text | Naar boven
Some more Dutch text';
   break;
case 'en':
   echo 'Some English text | Back to Top
Some more English text.';
endswitch;

It takes the page_alias and uses that do make a dynamic anchor for the 'Back to top' link.

2) I've also had to tweak function.lanselector.php to allow for mod_rewrite to work properly. This is also the fix for sparky's problem.
    Edit the file around line 35 as follows:
//$thepage = (isset($params['defaultpage']) ? $params['defaultpage'] : 'home.html');
if (isset($params['defaultpage']))
{
$thepage =$params['defaultpage']);
}
else
{
$thepage = $gCms->variables['page_name'];
$thepage .= '.html';
}

3) insert UDT in the template where you want it; in my case the footer

4) set $config['assume_mod_rewrite'] = true; in config.php. I am using the following (default) .htaccess file:
AddDefaultCharset UTF-8

RewriteEngine On

#Rewrites page.shtml as index.php?page
RewriteCond %{REQUEST_FILENAME} !-f [NC]

RewriteRule ^(.+)/(.+)\.html$ index.php?page=$2&lan=$1 [QSA]

5) done!

This works for me, but maybe someone else has a better way of doing this? Do note that this is working on the 0.12.2 multilanguage version from katon, so might not work with other versions!