Try our conversational search powered by Generative AI!

Customized Url Language-Market Routing

Vote:
 

Hi,

I am looking some advice on the best way to achieve the following.

We would like to change / introduce to the url a language and market segment e.g 'https://www.domain.com/en-gb/...','https://www.domain.com/fr-fr/...','https://www.domain.com/en-se/...'.

Has anyone tried something like this before?

Thanks

Paul

#297532
Mar 02, 2023 9:28
Vote:
 

If you setup languages via the manage website languages area within the admin section (including assigning the culture code you want to use in the URL path), and enable them, as well as adding fallback languages then you will be able to achieve what you need, examples of the steps to follow are in the screenshots below.

For your reference, here is the documentation on managing languages.

https://support.optimizely.com/hc/en-us/articles/4413192302477
https://support.optimizely.com/hc/en-us/articles/4413200662413-Work-with-multiple-languages 

#297629
Mar 03, 2023 8:58
Paul McGann (Netcel) - Mar 03, 2023 10:11
Hi Graham,

This approach did cross my mind, do you see any downside to this approach?

I take it you would need to write something to intercept the request and set the market accordingly?

Thanks

Paul
Graham Carr - Mar 03, 2023 10:25
Hi Paul,
There are various approaches that you could take to set the market accordingly:

The preferred content language is determined by the following rules:

1. If you have defined the host name to be associated with a specific language, that language is used. The setting is specified under Manage Sites in admin view.
2. If there is a language segment in the URL (like http://company.com/en/info), that language is used (en).
3, If you are in the edit view and have selected a specific language site from the Sites section, that language is used.
4. If the requests contain a query parameter or cookie named epslanguage, use the language defined by the query/cookie.
5. If the setting GlobalizationSettingsOptions.UseBrowserLanguagePreferences is true, then the language preference from the web browser is used.
6. Use the language mapped to wildcard host '*' if specified.
7. Fetch the setting from the GlobalizationOptions.UICultureLanguageCode.
8. If nothing else is discovered, use the first enabled language branch as defined in Admin / Language Branches, which means that it can be viewed as the default language.

I think points 4 and 5 relate directly to what you are asking, failing that you could go down the path of intercepting the route, there is some further information about Optimizely routing here:

https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/routing

and it is also worth mentioning that you can access the content language in various ways as described here:

https://docs.developers.optimizely.com/content-cloud/v12.0.0-content-cloud/docs/determining-languages

I hope that helps you out.

Thanks,

Graham
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.