Multilingual Sites in Treepl

I would be interested to know if any partners have made some experiences with multilingual sites in Treepl or are working on such sites at the moment. It’s not per se supported by Treepl yet, but there are some ways to achieve that - and also some road blocks. So that might be an interesting thread to open :slight_smile: .

I had done a couple in Business Catalyst which had a few methods that should be achievable in Treepl.

Depending on how you wanted URL’s to look (I really don’t know what’s considered best practice for SEO these days):

  1. If you wanted /en/page-name or /jp/page-name - just create the folders and pages and switch out the menu based on country selection.
    In the country menu selection you can append ?lang=en or ?lang=jp to url, and assign the language on page load like
    {% if request.request_url.params.lang == “en” %}
    {% assign menulang = “en” %}
    {% endif %}

Then use conditional to load the “en” menus in header/footer/sidebar etc, which has all the /en/page-name links in it…

When you switch to another country, it’ll place you in the new language subdirectory…

  1. Also on BC you could also do this by having different domains set for different countries.
    Eg. au.sitename.com
    jp.sitename.com

So you could use the same page url /page-name for all pages…
then, depending on the URL, you could load page content from a custom module.
The custom module will have fields such as
PageID
English Content
Japanese Content
etc.

Then, on each page, output the custom module and conditionally display only the content in the language that matches the domain…

ie. {% if request.request_url.hostname contains “au.sitename.com” %}
Show english content
{% endif %}

OR use case

{% liquid
case request.request_url.hostname
when "au.sitename.com"
  assign languge = 'en'
when "jp.sitename.com"
  assign language = 'jp'
else
  assign language = 'en' 
endcase %}

You can also add javascript to store cookie or sessionStorage or whatever to keep last language selected etc... so that returning 'jp' clients are presented with the site in japanese... etc.