Finally had a chance to test this new functionality and have been really impressed. For those wanting to try, here are the steps that I went though using the default site profile. In the following examples I am adding two languages English and German where the pages will be viewable with the language code preceding the url like /en/ and /de/
1.Install the latest development version - here is the zip download - https://github.com/r...archive/dev.zip
2. Install these 3 modules
- Languages Support
- Languages Support - Fields
- Languages Support - Page Names
3. Add a new language via the Languages setup page - I think naming here is only relevant for your code and does not affect the URL of the page
4. Open up the home page and look at Settings tab - the name (url) field should now have a field for each language you have added. Add an indicator for each language like /en and /de
This acts as a language gateway for changing the language. Now when ever you visit the site via /de it will set the users language to German and all the pages in the site will display the correct German language url.
note: I have not worked out how to redirect the default language (which is English) to /en - it always goes to the site root /
4. Add a simple language navigation switcher. This will allow users to switch the current page into the other language.
Edit : Refer to WillyC and Ryans language switcher further down - http://processwire.c...ge-3#entry33537
echo '<ul>'; $lang = $user->language; $langname = $lang->name == 'default' ? 'en' : $lang->name; $user->language = $languages->get('default'); $cssClass = $langname == 'en' ? 'class="active"' : ''; echo '<li '.$cssClass.'><a href="'.$page->url.'">EN</a></li>'; $user->language = $languages->get('de'); $cssClass = $langname == 'de' ? 'class="active"' : ''; echo '<li '.$cssClass.'><a href="'.$page->url.'">DE</a></li>'; $user->language = $lang; echo '</ul>';
I think that is pretty much it. All other PW development procedes as normal.
I also just switched over from the LanguageLocalizedURL module on one site - it was actually pretty easy to do - just uninstalled the module and went through the steps above - thanks soma and mcmorry for the original module - it was very useful at the time, but will be moving over this mainly so I can start using the ProCache module. I have tested the new language fields with ProCache and it also works great! Super fast, one tree multilingual sites, with the same ease as developing a regular processwire site - this is so cool!