current_path
seems to include the language component of the path. imho it should not
<a href={{get_url(path=current_path, lang='en' )}} .. > en
<a href={{get_url(path=current_path, lang='en' )}} .. > ja
one cannot remove the ‘ja’ component of the path to return to ‘en’
so i ended up with the following workable hack
where ‘lang’ is the current language
{% set mypath = current_path | default(value='') | trim_start_matches(pat="/"~lang~"/") %}
<li><a href="{{get_url(path=mypath, lang='en' )}}" >English</a></li>
<li><a href="{{get_url(path=mypath, lang='ja' )}}" >日本語<</a></li>
not sure current_path
should included the lang component of the path. or maybe a new function is warranted
Translations are adding the language code to the content Multilingual sites | Zola