{% macro tab(filter, name) %}
    <li><a class="filter" data-filter="{{ filter }}">{{ name }}</a></li>
{% endmacro %}

{% from _self import tab %}

<ul class="nav nav-tabs" id="filtertabs">

    {% for group in context.contenttype.groups %}
        {% if group == 'ungrouped' %}
            {{ tab(group, __('contenttypes.generic.group.ungrouped')) }}
        {% else %}
            {{ tab(group, __(['contenttypes', context.contenttype.slug, 'group', group], {DEFAULT: group|capitalize})) }}
        {% endif %}
    {% endfor %}

    {# Relationships and/or Taxonomy #}
    {% if context.contenttype.relations is defined and context.contenttype.taxonomy is defined %}
        {{ tab('taxonomy', __('contenttypes.generic.group.relations') ~ '/' ~ __('contenttypes.generic.group.taxonomy')) }}
    {% endif %}
    {% if context.contenttype.relations is defined and context.contenttype.taxonomy is not defined %}
        {{ tab('taxonomy', __('contenttypes.generic.group.relations')) }}
    {% endif %}
    {% if context.contenttype.relations is not defined and context.contenttype.taxonomy is defined %}
        {{ tab('taxonomy', __('contenttypes.generic.group.taxonomy')) }}
    {% endif %}

    {# Finally, a tab for Meta #}
    {{ tab('meta', __('contenttypes.generic.group.meta')) }}

</ul>

{% macro tab(filter, name) %}
    <li><a class="filter" data-filter="{{ filter }}">{{ name }}</a></li>
{% endmacro %}

{% from _self import tab %}

<ul class="nav nav-tabs" id="filtertabs">

    {% for group in context.contenttype.groups %}
        {% if group == 'ungrouped' %}
            {{ tab(group, __('contenttypes.generic.group.ungrouped')) }}
        {% else %}
            {{ tab(group, __(['contenttypes', context.contenttype.slug, 'group', group], {DEFAULT: group|capitalize})) }}
        {% endif %}
    {% endfor %}

    {# Relationships and/or Taxonomy #}
    {% if context.contenttype.relations is defined and context.contenttype.taxonomy is defined %}
        {{ tab('taxonomy', __('contenttypes.generic.group.relations') ~ '/' ~ __('contenttypes.generic.group.taxonomy')) }}
    {% elseif context.contenttype.relations is defined %}
        {{ tab('taxonomy', __('contenttypes.generic.group.relations')) }}
    {% elseif context.contenttype.taxonomy is defined %}
        {{ tab('taxonomy', __('contenttypes.generic.group.taxonomy')) }}
    {% endif %}

    {# Finally, a tab for Meta #}
    {{ tab('meta', __('contenttypes.generic.group.meta')) }}

</ul>

Simplify relations/taxonomy tab logic using elseif
Simplify relations/taxonomy tab logic using elseif