For this to work, you need to have pathauto, i18n module and translations activated. Also content type Page needs to have multilingual content activated.
Here is what I did:
1. In Pathauto, I gave Page a pattern with [lang] token, for example [lang]/[title-raw]
2. I created a Page called Frontpage and chose English as language
3. Translated it using the tab Translate to my own language (Finnish)
4. My Finnish frontpage is called Etusivu so it will have URL fi/etusivu created by pathauto. English page should have URL en/frontpage
5. Under Site information I put etusivu as default home page (i18n will strip the fi/ away from the path, so don't put it here)
6. I created a new URL alias en/etusivu pointing to the real path of the Frontpage (which was node/14) in my case.
Now Frontpage has two aliases pointing to it, en/frontpage and en/etusivu. If I don't add URL alias in part 6, I will get a "Page not found" error, because i18n will look for en/etusivu, which doesn't exist unless I create the alias.
You may wonder why I didn't use fi/etusivu. It works like I mentioned in my instructions. I had to create illogical alias en/etusivu pointing to the English frontpage, because I use etusivu as the homepage in site information of Drupal configuration. So if the user has English as chosen language, the user will be redirected to frontpage instead of etusivu. If I understood the i18n module right.
Comments
Using pathauto for language prefix?
It this realy right way? What do you have setup in "admin/settings/language/configure"?
When I use Path prefix only. or Path prefix with language fallback. it generates me language prefix automatically. So if I'll setup pathauto, it will duplicates that prefix, IMHO..
Just now I find this duplicate, diff solution:
http://drupal.org/node/357248
I don't have such setting in
I don't have such setting in Drupal5. In i18n module setting I have selected "Only current language and no language". It is working fine for me, maybe i18n only adds the prefix when it doesn't exist already.
Solution you mentioned should work fine, but I'm not sure if it works in Drupal5.
What you did in a simple way:
in this way it can also be applied to drupal 6.
settings.php > i18n_variables
Set the variables in your settings
$conf['i18n_variables'] = array(
// Site name, slogan, mission, etc..
// 'site_name',
// 'site_slogan',
// 'site_mission',
// 'site_footer',
// 'anonymous',
// Different front page for each language
'site_frontpage',
// Primary and secondary links
// 'menu_primary_links_source',
// 'menu_secondary_links_source',
// Contact form information
// 'contact_form_information',
);
Then, on the site information page, change language and set your home.
When I try and set this up my
When I try and set this up my Spanish homepage loads /es/ instead of /es/home. This only seems to be broken when navigating from the homepage. If I go to other pages and switch to Spanish all works ok and I can click home in the menu and it loads the proper homepage.
It seems that node/1 translations are not loading /home for any language or picking up the lang switch - Im using language switcher block, EN is the default language and all non EN homepages have home set as their path...?
If I build URL aliases for e.g. node/369 to point to es/home this does not get picked up, have tried this with all langs, en and es
Drupal development | SEO optimised build
Workaround multi-lingual frontpage
Solved as follows:
-frontpage in English is node/2
- in my theme I made the file page--front.tpl.php with the command:
So when you go to the home page, the sytem selects node/2 first, and depending on the selected language it selects the corresponding page.
When you make a page multi-lingual and you select the original, Drupal selects the corresponding page according to the selected language.
E.g I have node/2 in English and node/6 in Dutch. When I select node/2, and my language is set to Dutch the system renders node/6 automatically
The problem with the frontpage is, that when you select it, the node number is not displayed so the system can not make a distiction.
Tried the suggestion above
Tried the suggestion above with
page--front.tpl.php
with the commandheader( 'Location: node/xx' ) ;
but that gives me a page not found error with urlmysite/node/node/xx
and when I useheader( 'Location: /node/xx' ) ;
then I get a redirect loop. (D7 and latest modules)$front_page, unlike
$front_page, unlike $base_path contains the prefix (or even language domain).
As documented here: http://drupal.org/node/462414
You can then use it in your page--front.tpl.php in concert with themekey (check out user:language and or if you've set language subdomains, system:host).
Themekey is a great solution if you're going to do a lot of language dependent theming and/or you're overriding the entire front page for each language but still undoubtedly require the use of system variables.
Or perhaps more simply without themekey or entire page override using a single theme with context pointing to some nodes.
Or even good ol' (and much improved in D7!), Drupal blocks.