You are currently browsing documentation for Diem 5.1 - Switch to version5.0

Internationalization

Tools for building multilingual website

Multilingual website

Available cultures can be declared in
config/dm/config.yml

all:  

  i18n:  
    cultures:  [ en, fr, de ]  

The first culture is the default one.

Culture switcher

Authenticated users can use the tool bar culture selector.
To allow non-authenticated users to switch to another culture, the dmCore/selectCulture action can be used.

In a front template:

echo _open('ul');
 
foreach(sfConfig::get('dm_i18n_cultures') as $culture)  
{  
  echo _tag('li',  
    _link('+/dmFront/selectCulture')  // link to the dmFront/selectCulture symfony action  
    ->param('culture', $culture)      // the culture parameter  
    ->param('page_id', $dm_page->id)  // by passing the current page id, we get redirected to this page after the culture changed  
    ->text($culture)                  // the link text  
  );  
}  
 
echo _close('ul');  

This template uses Diem Template helpers.

The dmFront/selectCulture action will change the user culture, then redirect to the previous page.

Questions and Feedback

If you need support or have a technical question, you can

  • Get help with the Google Group
  • Get help with the Forum
  • Come and chat on the #diem IRC channel on freenode

The documentation is hosted on GitHub. Feel free to submit issues and patches!

Fork Diem on GitHub