2. Multilingual sites
Prev | Chapter 8. Tips | Next

## 2. Multilingual sites

Since MeshCMS pages are simple HTML files, a page cannot contain multiple versions of itself, so different languages must be managed separately. Nevertheless, MeshCMS offers some expedients to deal with multiple languages.

Multilanguage support is based on building identical (or at least similar) trees of pages under pages at the first level that will have the path equal to language codes. If you follow that structure, pages that differ only at the first level will be matched as different versions of the same page.

To make it easier to understand, let's see an example. Suppose that you have to create a site in two languages: English and Italian. Here are the steps to follow:

1. start with a welcome page that offers a language choice, or enable automatic home page redirection in the configuration;

2. create a directory for each language, making sure that the each directory is named after a language code (i.e. `en` and `it` in our example);

3. in your theme, use the setlocale tag without specifying the `value` attribute. This way the locale code will be taken from the url, and will be `en` or `it` according to the page that is currently displayed (you can use the `defaultValue` attribute to set a default);

4. apply the theme to both home pages, so navigation menus will start from the language root instead of the site root;

5. finally, use the langmenu tag to add a menu of languages to your theme (you could also use a customized one, but this tool is handy since it points directly to the translated page if available).

This way you get a site that separates languages correctly. You could also put common images in a directory at the root level (e.g. `/images`).

Prev | Up | Next
1. TinyMCE configuration | Home | 3. Publish a Sitemap