Search

This is a very condensed summary of the multi-lingual site I am building with Symphony. This post — as well as my site — is a work in progress, but I’m putting this here to help out anyone else who would like to create something similar.

Site requirements

  1. “Parallel” localised content (eg same page tree for all languages)
  2. Single edit page for a page in all languages
  3. Localised URLs, i.e.:
    • http://my.site.com/en/my-amazing-page
    • http://my.site.com/fr/ma-page-detonnant
  4. Different domain for each language, i.e.:
    • http://my.site.com/my-amazing-page
    • http://my.site.fr/ma-page-detonnant
    • NOTE Still have not implemented this, but all it should take is a few lines in my .htaccess file.

How I achieved this

  1. An individual Symphony page called home for the front page.
  2. A single Symphony page called static for all other pages on the site, with URL params page1/page2/page3 (limiting my maximum page depth to 3 pages).
  3. Root page params extension with settings:
    • Page to append parameters to: /static
    • Map subpages to homepage (checked)
  4. Language Redirect and Multilingual Field plugins. (Multilingual Field customised as described here)
  5. A section called Pages which contains a bunch of Multilingual Fields, including one for URL Handle. Heirarchy is “achieved” with a Parent Page field (using Select Box Link).
  6. A datasource called Page which uses the Pages section with the following URL Handle filter:

    {$page3}, {$page3}{$page2}, {$page3}{$page2}{$page1:home}

  7. In my templates I can then just access /data/page/entry and use normally.

  8. For navigation, I have another datasource which returns all Pages, grouped by Parent page. Then some fancy XLST to display them in a nested fashion (recursively).

I’ve been looking forward to reading your method, I may have to do multilingual stuff very soon! Cheers!

Different Language domains

This is how removed the use of /fr/ URL parameters and instead set up a different domain per language.

  1. Obviously set up your domains/vhosts as required (example here).
  2. Keep the Language Redirect extension enabled, but do not use the Language Redirect event on any of your pages (this will force redirection using URL paramets, which we don’t want).
  3. You need to add some custom .htaccess rules to “inject” the /fr/ param behind the scenes, depending on the domain being used by the client. Mine looks something like this, added at the very beginning of the file (before the Symphony stuff):

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    
    # Redirect when in wrong domain
    RewriteCond %{HTTP_HOST} my.site.com [NC]
    RewriteRule ^(fr)/.*$ http://my.site.$1 [L,R=seeother]
    RewriteCond %{HTTP_HOST} my.site.fr [NC]
    RewriteRule ^(en)/.*$ http://my.site.$1 [L,R=seeother]
    
    # English
    RewriteCond %{HTTP_HOST} my.site.com [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/symphony/.*$
    RewriteRule ^(en/)?(.*)$ index.php?language=en&region=&symphony-page=$2&%{QUERY_STRING} [L]
    
    # French / Francais
    RewriteCond %{HTTP_HOST} my.site.fr [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/symphony/.*$
    RewriteRule ^(fr/)?(.*)$ index.php?language=fr&region=&symphony-page=$2&%{QUERY_STRING} [L]
    
    </IfModule>
    

So far this seems to work for me, although I’m almost sure I’ll discover some particular case when it f’s up for me. Will update as necessary.

@jstar198

Can you post your fields in pages section? I try to recreate but at the moment i have much errors :-)

Great post! really explains a lot of what's possible with some thinking in Symphony! Thanks for posting. Would it still be possible without using Multilingual field and maybe use Page Tabs extension to organise languages just planning something a little different see?

I'm trying to multi language website and I have a question about links, I need this big structure right?

<a href="/{$current-lang}/{/data/plh-page/page/item[@lang=$current-lang]/@handle}/{titulo/item[@lang=$current-lang]/@handle}">

Thanks,

Something like this, yes.

Thanks @vladG !

Use

### LANGUAGE REDIRECT RULES start
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(de|en|es|fr)-?()?/(.*/?)$ index.php?fl-language=$1&fl-region=$2&symphony-page=$3&%{QUERY_STRING} [L]
### LANGUAGE REDIRECT RULES end

It's what I used on http://www.sante.de/en/

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details