5 users online. Create an account or sign in to join them.Users
Creating a multi-lingual site with localised URLs
This is an open discussion with 4 replies, filed under General.
Search
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.
- Obviously set up your domains/vhosts as required (example here).
- Keep the
Language Redirectextension 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). You need to add some custom
.htaccessrules 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®ion=&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®ion=&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?
Create an account or sign in to comment.
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
http://my.site.com/en/my-amazing-pagehttp://my.site.com/fr/ma-page-detonnanthttp://my.site.com/my-amazing-pagehttp://my.site.fr/ma-page-detonnant.htaccessfile.How I achieved this
homefor the front page.staticfor all other pages on the site, with URL paramspage1/page2/page3(limiting my maximum page depth to 3 pages)./staticchecked)Pageswhich contains a bunch of Multilingual Fields, including one forURL Handle. Heirarchy is “achieved” with a Parent Page field (using Select Box Link).A datasource called
Pagewhich uses thePagessection with the followingURL Handlefilter:{$page3}, {$page3}{$page2}, {$page3}{$page2}{$page1:home}In my templates I can then just access
/data/page/entryand use normally.Pages, grouped byParent page. Then some fancy XLST to display them in a nested fashion (recursively).