Hi,
I wonder if it would be possible to create a multi-language site with Couch. I was thinking about using the first segment as a language switch. I could use PHP to read that segment and write a conditional to show the right fields. (I haven't yet figured out how to deal with the different templates (en.php, nl.php and de.php) but I think that wouldn't be to hard).
Would this approach be the best way to deal with it? Or are there other (better) ways to (for instance) retrieve the names of the segments?
I wonder if it would be possible to create a multi-language site with Couch. I was thinking about using the first segment as a language switch. I could use PHP to read that segment and write a conditional to show the right fields. (I haven't yet figured out how to deal with the different templates (en.php, nl.php and de.php) but I think that wouldn't be to hard).
Would this approach be the best way to deal with it? Or are there other (better) ways to (for instance) retrieve the names of the segments?
- Code: Select all
<?php
$_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $_SERVER['REQUEST_URI_PATH']);
if ($segments[1] == "en")
{ ?>
<cms:show text_en />
<?php }
else if ($segments[1] == "nl")
{ ?>
<cms:show text_nl />
<?php }
else if ($segments[1] == "de")
{ ?>
<cms:show text_de />
<?php } ?>