Is there a way to get supportedSites for a category page? I'm working on a site that is available in multiple languages and I would like to build a language switcher that will work for both category pages and single entries. 

In Craft v2 that was possible but once I switched to Craft v3, I can't find a way to do get the current category page. 

For single entries I do the following (simplified):

{% for siteForEntry in entry.getSupportedSites %}       
    {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}        
    {% if site.id == entry.siteId %}
        &lt;li class="language-selection--active-language"&gt;
           &lt;a href="#"&gt;{{ site.language }} &lt;/a&gt; 
        &lt;/li&gt;
    {% else %}            
        {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}
            &lt;li class="{% if site.id == entry.siteId %} language-selection--active-language{% endif %} "&gt;
                &lt;a href="{{ entryForOtherSite.getUrl() }}"&gt;{{ site.language }} &lt;/a&gt;
             &lt;/li&gt;
        {% endif %}
 {% endfor %}


Is there a way to do the same thing for categories?
It turns out that getSupportedSites() returns different results for categories and standard entries so an additional check needs to take place. 

The solution below has been tested with a single group with multiple languages, and it works, although I hope there's a better solution than this one:

If the current page is a category then assign it to the entry variable

{% set entry = category %}


Then:

{# Retrieve all supported sites for the current entry #}
{% set supportedSites = entry.getSupportedSites %}

&lt;ul&gt;
{% for siteForEntry in supportedSites %}
  {% if siteForEntry | length == 1 %}
    {# category #}
    {% set site = craft.app.getSites.getSiteById(siteForEntry) %}
    {% set entryForOtherSite = craft.categories.id(entry.id).site(site).one() %}
  {% elseif siteForEntry | length == 2 %}
    {# standard entry #}
    {% set site = craft.app.getSites.getSiteById(siteForEntry.siteId) %}
    {% set entryForOtherSite = craft.entries.id(entry.id).site(site).one() %}
  {% endif %}

  {% if site.id == entry.siteId %}
      {# This is the current language, mark it as active and don't retrieve its url #}
      &lt;li class="current"&gt;&lt;a href="#"&gt;{{site.language}}&lt;/a&gt;&lt;/li&gt;
  {% else %}
      {# if it's not the current site, get the entry for this site #}
      &lt;li&gt;&lt;a href="{{ entryForOtherSite.getUrl() }}"&gt;{{site.language}}&lt;/a&lt;/li&gt;
  {% endif %}

{% endfor %}
&lt;/ul&gt;