Struggling with language switcher for Craft 3
I think I might finally have it working. If someone has a more elegant way to handle the index, tag and category I would love to see it! 

        &lt;!-- entry --&gt;
        {% if entry is defined %}

            {% for siteForEntry in entry.getSupportedSites %}

                {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}

                {% if site.id != entry.siteId %}

                    {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}

                    {% if entryForOtherSite is not null %}

                        &lt;li&gt;&lt;a href="{{ entryForOtherSite.getUrl() }}"&gt;{{ site.name }}&lt;/a&gt;&lt;/li&gt;

                    {% endif %}

                {% endif %}

            {% endfor %}

        &lt;!-- category --&gt;
        {% elseif category is defined %}

            {% set currentSite = craft.app.sites.currentSite %}

            {% set sites = craft.app.sites.getAllSites() %}

            {% for site in sites %}

                {% if site.id != currentSite.id %}

                    &lt;li&gt;&lt;a href="{{ site.baseUrl }}blog/category/{{craft.request.getLastSegment()}}"&gt;{{ site.name }}&lt;/a&gt;&lt;/li&gt;

                {% endif %}

            {% endfor %}

        &lt;!-- index and tags --&gt;
        {% else %}

            {% set currentSite = craft.app.sites.currentSite %}

            {% set sites = craft.app.sites.getAllSites() %}

            {% for site in sites %}

                {% if site.id != currentSite.id %}

                    &lt;li&gt;&lt;a href="{{ site.baseUrl }}{% for segment in craft.request.getSegments() %}{{segment}}/{% endfor %}"&gt;{{ site.name }}&lt;/a&gt;&lt;/li&gt;

                {% endif %}

            {% endfor %}

        {% endif %}