Reputation: 63
I'm using Sitecore and I'm wanting to make my site multi-regional and multi-lingual.
I want the url to be in the following format:
http://www.example.com/ca/fr (region then language)
I currently have this in my config:
<site patch:before="site[@name='website']"
name="Canada" enableTracking="true"
virtualFolder="/ca" physicalFolder="/ca"
language="en-gb"
rootPath="/sitecore/content/CanadaSite"
startItem="/home" database="master"
domain="extranet" allowDebug="true"
cacheHtml="true" htmlCacheSize="50MB" registryCacheSize="0"
viewStateCacheSize="0" xslCacheSize="25MB" filteredItemsCacheSize="10MB"
enablePreview="true" enableWebEdit="true" enableDebugger="true"
disableClientData="false" cacheRenderingParameters="true"
renderingParametersCacheSize="10MB" />
I have one complication in my project in the moment, the us version of English is also installed, but I always want the path to be /en. I don't think it's being used for any content.
Gemma
Upvotes: 0
Views: 1128
Reputation: 36
The default sitecore implementation for URL of a multilingual site is http:////
In your case, if you are setting the virtualFolder as /ca, then your URL would be http://www.example.com/fr/ca
instead of the desired /ca/fr and /ca/en
Also the default sitecore behavior is to display in the url. For ex: fr-ca. However, it is easy to write a custom link resolver so that instead of /fr-ca, the custom link resolver will output /fr. But your original issue of language preceding the virtual folder name will not be addressed.
I do not recommend you to change the custom link resolver to output language after the virtualFolder name. I have not attempted such a customization and do not know what pitfalls you may encounter, need to make sure that preview, experience editor etc all work with such a customization.
The only other thing that you can look into is creating completely different sitenodes in the content tree and then you will need a corresponding site definition to point to that site node. In this approach the virtual folder in the site definition will be "/ca/en", "/ca/fr" and so on as shown below
site patch:before="site[@name='website']"
name="CanadaFrench"
language="fr-ca"
virtualFolder="/ca/fr"
physicalFolder="/ca/fr"
rootPath="/sitecore/content/CanadaFrenchSite"
site patch:before="site[@name='website']"
name="CanadaEnglish"
language="en-us"
virtualFolder="/ca/en"
physicalFolder="/ca/en"
rootPath="/sitecore/content/CanadaEnglishSite"
This approach will work, you just need to configure each of your site to languageEmbedding="never". However, i would not recommend this approach as well, because we are completely bypassing sitecore's language versioning - in this approach you are just creating new site node for each language.
Upvotes: 1
Reputation: 191
You may want to rethink using this Structure. I do not know your requirements, but the first problem that you would get is the default Sitecore behaviour.
For example, i have a site with the different domains:
if I call mysite.com then the item with the English language will be served. If I call mysite.com/fr or mysite.com/fr-fr then the French contents (if there is any and depends on language configuration) will be served.
so you should be careful with your url paths
mysite.com/[language-culture]/page name
mysite.com/[language]/page name
this is the default behaviour of the Sitecore.
Anyway, I do not know your requirements and at the end, you can define an extra site config and map it to the same node in sitecore for english version.
<site patch:before="site[@name='website']"
name="CanadaEnglish"
language="en"
virtualFolder="/ca"
physicalFolder="/ca"
rootPath="/sitecore/content/CanadaSite" ...
<site patch:before="site[@name='website']"
name="CanadaEnglishUS"
language="en-us"
virtualFolder="/ca"
physicalFolder="/ca"
rootPath="/sitecore/content/CanadaSite" ...
The trick is to give the new Name like name="CanadaEnglish" and name="CanadaEnglishUS"
Upvotes: 0