by
KK » Fri Dec 17, 2010 2:30 am
Hi Singurb,
Your English is perfectly fine

I think I understood you right but was not able to answer to your satisfaction.
Allow me to have another go -
Let us suppose you need the contents of the site to be in two languages - English and French.
There can be two different approaches to tackle this -
1. Give each language its own domain e.g
en.yourwebsite.com
fr.yourwebsite.com
In this approach, we have two different domains so Couch will need to be installed in both of them. Basically you'll have two separate sites each with its own separate admin section, so nothing new here.
2. Give each language a sub-folder e.g.
http://www.yourwebsite.com/en/http://www.yourwebsite.com/fr/This seems to be the most followed approach out there and so I'll look at it a little closer -
Suppose this was the original structure of a Couch managed site with only one language (say, English) -
- Code: Select all
site_root
|_couch (folder)
|_index.php
|_about.php
|_news.php
There are three templates with the news template being a clonable template.
Each of the templates will be enclosed within the mandatory
<?php require_once( 'couch/cms.php' ); ?> and
<?php COUCH::invoke(); ?> lines.
In any Couch tag where the
masterpage parameter (i.e. name of the template ) needs to be supplied, we can use 'index.php', 'about.php' and 'news.php' as the names of the three templates.
This is all routine stuff. I am repeating it so that it can be compared to what follows.
Had the same site been multi-lingual (say English and French), the following could be a possible setup -
- Code: Select all
site_root
|_couch (folder)
|_en (folder)
| |_index.php
| |_about.php
| |_news.php
|_fr (folder)
| |_index.php
| |_apropos.php
| |_nouvelle.php
|_index.php
We have now created the French versions of the three templates and placed them within a separate folder named 'fr' while the English templates are moved to a folder named 'en'.
So now we have six templates instead of three. Notice also the index.php that resides directly in the root which makes it seven templates in all. We'll talk about it in just a while.
Important thing is that there is only one couch installation.
Placing the templates within sub-folders will require two little changes that you need to be aware of -
1.
The mandatory php code placed at the beginnng of the templates placed within the subfolders will now become -
- Code: Select all
<?php require_once( '../couch/cms.php' ); ?>
Notice the '..' that denotes that the couch folder is one level up in the hierarchy.
The seventh template that resides directly within the root will not need this adjustment.
2.
The name of the templates will now become -
'en/index.php', 'en/about.php', 'en/news.php', 'fr/index.php', 'fr/apropos.php', 'fr/nouvelle.php'
Notice how the names now have the folder names prefixed.
The seventh template will be simply 'index.php'.
So now any tag that has the
masterpage attribute will need to be given these adjusted names.
With this setup, you can now create contents in both the languages as the admin panel will show them as separate templates.
The index.php that resides in the root can be used to direct the users to their desired language. It could be by explicitly asking them their preferred language or you can use the redirect tag to automatically make them land on the default language, say English
- Code: Select all
<cms:redirect url='http://www.yourwebsite.com/en/' />
With prettyURLs enabled, the links to pages will be -
http://www.yourwebsite.com/http://www.yourwebsite.com/en/http://www.yourwebsite.com/en/about/http://www.yourwebsite.com/en/news/http://www.yourwebsite.com/en/news/my_news.htmlhttp://www.yourwebsite.com/fr/http://www.yourwebsite.com/fr/apropos/http://www.yourwebsite.com/fr/nouvelle/http://www.yourwebsite.com/fr/nouvelle/ ... elles.htmlHope my explanation makes sense

Do let us know if you have any doubts.