Search

Hi guys!

I’m developing an multi-lang website and I’d like to know how the best way to send and keep an url parameter with the active language. Ex:

www.domain.com/en/sample-page www.domain.com/pt/sample-page www.domain.com/es/sample-page

Can anyone has an idea of how I can use this parameter?

Note: The section has a specific field for the language (using the extension Language Field).

Thanks a lot!

Using a htaccess file is probably the easiest thing to do. You should rewrite www.domain.com/lang/page to www.domain.com/page/lang.

Then you should filter the datasource on the url parameter, and put the lang in all links using xslt.

Sounds like a lot of work, though..

I started to write the Language Redirect extension that allows you to do exactly what you want. I’m using it at two sites I’m developing at the moment but it’s still in beta. The extension adds a rule like

    RewriteRule ^(en|pt|es)-?(gb|us)?/(.*/?)$ index.php?language=$1&region=$2&symphony-page=$3&%{QUERY_STRING} [L]

to the .htaccess file, so you can use the $url-language and $url-region parameters to filter your datasources. The extension also saves the current parameters in a cookie and adds those to the parameter pool for dynamic language links.

Thanks (a little bit late) a lot!

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