Add active class and territory name to language switcher
The comparison is meant to be used within the for loop that loops your array of locales. And you can of course only compare the current locale tag craft.locale to real locale tags and not with fake ones like 'en_001' that Craft doesn't know about.

{% set locales = ['en', 'en_gb'] %}

{% for locale in locales %}
    {% set current = (locale == craft.locale) ? true %}
{% endfor %}


So you need to find a way to map real locales to your fake ones! The real ones for your craft.locale comparison and the fake ones to get your territories. But then there would be no need to compose fake ones to start with and you would simply map the real locales you installed and use in Craft to the territory names or territory codes for your output string. So let's do this.

{% set locales = {
    'en':    '001',
    'en_gb': 'gb',
    'hu':    'sk',
    'de':    'sk',
} %}

{% for locale, territory in locales %}

    {% set current = (locale == craft.locale) ? true %}

    {% set territory = craft.i18n.getLocaleData(craft.locale).getTerritory(territory) %}
    {% set language = craft.i18n.getLocaleById(locale).name %}
    {% set language = language|replace("/- #{territory}$/", '') %}

    {% if territory and language %}
        &lt;li class="{{ current ? 'myCurrentLocale'}}"&gt;
            Territory: {{ territory }},
            Language: {{ language }}
        &lt;/li&gt;
    {% endif %}

{% endfor %}