<div id="language-menu"
     tal:define="
       translations_view nocall:here/translations_view;
       default_language translations_view/default_language;
       current_language python: translations_view.get_obj_language_code(here);
       is_default python: not here.language or current_language == default_language;
       current_language_name python: translations_view.get_obj_language_name(here);
     "
     i18n:domain="ploneintranet"
>

  <ul class="menu">
    <li>
      <a class="icon-angle-right">
        <strong>
          ${current_language_name}
          <tal:if condition="not:is_default">
            (<tal:i18n i18n:translate="">Current</tal:i18n>)
          </tal:if>
          <tal:if condition="is_default">
            (<tal:i18n i18n:translate="">Current, Default</tal:i18n>)
          </tal:if>
        </strong>
      </a>
      <a class="icon-angle-right pat-inject close-panel"
         href="${translation/absolute_url}/@@edit.html#document-body"
         data-pat-inject="history: record"
         tal:repeat="translation translations_view/get_translations"
      >
        ${python:translations_view.get_obj_language_name(translation)}
        <tal:if condition="python: not translation.language or default_language == translation.language">
          (<tal:i18n i18n:translate="">Default</tal:i18n>)
        </tal:if>
      </a>
    </li>
  </ul>
  <ul class="menu">
    <li>
      <a class="pat-modal close-panel icon-plus-squared-alt"
         href="${here/absolute_url}/@@panel-create-language#document-content"
         data-pat-modal="class: small panel"
         tal:condition="python: is_default and translations_view.can_add_translation"
         i18n:translate=""
      >
        Add a language
      </a>
      <a class="pat-modal close-panel icon-minus-squared-alt"
         href="${here/absolute_url}/@@panel-remove-language#document-content"
         data-pat-modal="class: small panel"
         tal:condition="python: not is_default and translations_view.can_delete_translation"
         i18n:translate=""
      >
        Remove this language (<tal:i18n i18n:name="lang">${current_language_name}</tal:i18n>)
      </a>
    </li>
  </ul>
</div>
