<li class="lang-switcher dropdown">
    <a class="active" href="{{ .Permalink }}" lang="{{ .Site.Language.Lang }}">
      <img src="/flags/{{ .Site.Language.Lang }}.png" alt="{{ .Site.Language.Lang }}" height="20px">
    </a>
    <ul class="dropdown-menu">
    {{ if .IsTranslated -}}
      {{ range .Translations }}
          <li><a href="{{ .Permalink }}" lang="{{ .Lang }}">
            <img src="/flags/{{ .Lang }}.png" alt="{{ .Lang }}" height="20px">
          </a></li>
      {{ end }}
    {{ else }}
      {{ range .Site.Languages }}
        <li><a href="/{{ .Lang }}" lang="{{ .Lang }}">
            <img src="/flags/{{ .Lang }}.png" alt="{{ .Lang }}" height="20px">
        </a></li>
    {{ end }}
  {{ end }}  
    </ul>
</li>

{{ if gt (len .Site.Languages) 2 }}
  <li class="lang-switcher dropdown more-than-two-lang">  
    <a class="active" href="{{ .Permalink }}" lang="{{ .Site.Language.Lang }}">
      <img src="/flags/{{ .Site.Language.Lang }}.png" alt="{{ .Site.Language.Lang }}">
    </a>
    <ul class="dropdown-menu">
    {{ if .IsTranslated -}}
      {{ range .Translations }}
          <li><a href="{{ .Permalink }}" lang="{{ .Lang }}">
            <img src="/flags/{{ .Lang }}.png" alt="{{ .Lang }}">
          </a></li>
      {{ end }}
    {{ else }}
      {{ range .Site.Languages }}
        {{ if not (eq .Lang $.Site.Language.Lang) }}
        <li><a href="/{{ .Lang }}" lang="{{ .Lang }}">
            <img src="/flags/{{ .Lang }}.png" alt="{{ .Lang }}">
        </a></li>
        {{ end }}
    {{ end }}
  {{ end }}  
    </ul>
  </li>
{{ else }}
  <li class="lang-switcher dropdown two-lang">  
    {{ if .IsTranslated -}}
      {{ range .Translations }}
          <a href="{{ .Permalink }}" lang="{{ .Lang }}">
            <img src="/flags/{{ .Lang }}.png" alt="{{ .Lang }}">
          </a>
      {{ end }}
    {{ else }}
      {{ range .Site.Languages }}
        {{ if not (eq .Lang $.Site.Language.Lang) }}
        <a href="/{{ .Lang }}" lang="{{ .Lang }}">
            <img src="/flags/{{ .Lang }}.png" alt="{{ .Lang }}">
        </a>
        {{ end }}
    {{ end }}
  {{ end }}  
  </li>
{{ end }}


Add special case when only two languages
Add special case when only two languages
