Multilangual Setup

Folder Setup

/cms-canvas
    /application
    /assets
    /en
        .htaccess
        .index.php
    /es
        .htaccess
        .index.php
    /fr
        .htaccess
        .index.php
    /install
    /system
    /themes
        .htaccess
        favicon.co
        index.php
        lincense.txt
        README.md

To add a new language to your website, create a new directory in Page Studio’s root directory and give it the name of the language code (ex: fr). Copy the index.php and the .htaccess from the Page Studio’s root directory and paste it into this new directory.

Open the .htaccess in the fr directory and change:

From:

RewriteBase /

To:

RewriteBase /fr/

Save your changes and now open the index.php inside the “fr” directory.

Change the following lines:

From:

$system_path = 'system';

To

$system_path = '../system';

From:

$application_folder = 'application';

To:

$application_folder = '../application';

From:

$assign_to_config['global_tags']['lang'] = 'en';

To:

$assign_to_config['base_url'] = dirname(BASE_URL) . '/';
$assign_to_config['site_url'] = BASE_URL;
$assign_to_config['global_tags']['lang'] = 'fr';

Content Setup

Next you will want to create a content field for each language translation starting with the language code.

Then in your content type simply reference your field with the following tag syntax:

{{ {{ lang }}_title }}

Now when you visit your website with the following URL at http://example.com/fr/ you will see your French translations and now all navigational page links will automatically now point to http://example.com/fr/some-page.