May be it will be useful for someone else.
This is tempating issue. Many thanks to smartass101
You could do something like this:
{% if lang_siteurls %}
{% for lang, url in lang_siteurls.items() %}
<li{% if lang == DEFAULT_LANG %} class="active"{% endif %}>
<a href={% if article and lang != DEFAULT_LANG %}"{{ SITEURL }}/{{ article | extract_trans(lang, url) }}"
{% elif article %}"{{ SITEURL }}/{{ article.url }}"
{% elif page and lang != DEFAULT_LANG %}"{{ SITEURL }}/{{ page | extract_trans(lang, url) }}"
{% elif page %}"{{ SITEURL }}/{{ page.url }}"
{% else %}"{{ url }}"{% endif %}>{{ lang }}</a></li>
{% endfor %}
<!-- separator -->
<li style="background-color: white; padding: 5px;"> </li>
{% endif %}
where the filter is defined as
def extract_trans(article, lang, url):
for trans in article.translations:
if trans.lang == lang:
return trans.url
return url
and included using the JINJA_FILTERS setting. This code works for me for all pages and articles with exception of archives.