This topic has been discussed a million times but for some reason I still can't find a proper solution. I'm trying to go with the hostname solution for a multi lingual website. My structure is very simple:
en
--home
--some page
fr
--home
--some page
etc...
My goal is to have a single domain website and to differentiate between language using the usual .../en/ or .../fr/. so for example, www.site.com/en/home will lead to the english homepage and www.site.com/fr/home will lead to the french one.
I've set up hostnames/subdomains for all my language root nodes except english. I've set "umbracoHideTopLevelNodeFromPath" to false in my web.config. I've set "useDomainPrefixes" to true under umbracoSettings.config. I don't know if i'm missing anything else.
The english version the URL generation works fine. In other languages for some reason, when entering @page.Url and @Umbraco.NiceUrl(page.Id) I get the exact same URL which includes my fake subdomain. I would like it to ignore the subdomain thing. I want it to spit out a regular relative url. The one that makes sense according to the node structure. I can't figure out a way to do that. It insists on giving me urls with the fake subdomains. I can write my own url writing function but I feel like it's stupid and there should be a simple solution to this problem.
This whole language tied to domain thing needs to go away. It looks like it should work in this version because you can set a culture to any node without a hostname. But you can't retrieve that language by querying contentService.GetById(node.Id).Language (http://our.umbraco.org/forum/developers/api-questions/43257-Language-=-null-on-contentServiceGetById()). This forced me to add hostnames like www.mysite.com/en and www.mysite.com/fr for now. This also means that my links must be absolute. Kind of frustrating.
I tried making my own URL generator that overrides that whole domain thing. All was well until I clicked a page that had umbracoRedirectId in it and it redirected to the fake domain :)
Multi language setup on a single domain
Hi,
This topic has been discussed a million times but for some reason I still can't find a proper solution. I'm trying to go with the hostname solution for a multi lingual website. My structure is very simple:
en
--home
--some page
fr
--home
--some page
etc...
My goal is to have a single domain website and to differentiate between language using the usual .../en/ or .../fr/. so for example, www.site.com/en/home will lead to the english homepage and www.site.com/fr/home will lead to the french one.
I've set up hostnames/subdomains for all my language root nodes except english. I've set "umbracoHideTopLevelNodeFromPath" to false in my web.config. I've set "useDomainPrefixes" to true under umbracoSettings.config. I don't know if i'm missing anything else.
The english version the URL generation works fine. In other languages for some reason, when entering @page.Url and @Umbraco.NiceUrl(page.Id) I get the exact same URL which includes my fake subdomain. I would like it to ignore the subdomain thing. I want it to spit out a regular relative url. The one that makes sense according to the node structure. I can't figure out a way to do that. It insists on giving me urls with the fake subdomains. I can write my own url writing function but I feel like it's stupid and there should be a simple solution to this problem.
Any help will be appreciated!
Thanks,
Eyal
Hi Eyal,
This is definitely working differently in V7 compared to V4.
In V4 the hostnames/subdomains were displayed in the properties tab as alternative links. I'll post this as a bug.
Hi Anthony,
Thanks!
This whole language tied to domain thing needs to go away. It looks like it should work in this version because you can set a culture to any node without a hostname. But you can't retrieve that language by querying contentService.GetById(node.Id).Language (http://our.umbraco.org/forum/developers/api-questions/43257-Language-=-null-on-contentServiceGetById()). This forced me to add hostnames like www.mysite.com/en and www.mysite.com/fr for now. This also means that my links must be absolute. Kind of frustrating.
I tried making my own URL generator that overrides that whole domain thing. All was well until I clicked a page that had umbracoRedirectId in it and it redirected to the fake domain :)
Hope they fix it soon,
Eyal
You can get around this if you enter the hostname as www.site.com/fr but you will have to change it for your local/dev/live sites so not ideal.
(Posted before I saw you said the same above :)
I've got it working without adding a hostname. Use the Dictionary to add/lookup the language for the page.
nice!
i'll give it a try later on tonight.
Thanks man!
is working on a reply...