How to use localized categories properly? I've setup a localized site (de/en) with custom routing for my categories (which are marked as translatable). I use a tag route for my categories which points to the same template as my structure. Everything seemed to work fine but then I realized that the custom filter (via relatedTo) also outputs entries that don't belong to the current category locale.

To make it clear I'll try to give a rough schemata of my setup (using Craft Pro 2.3.2640):

section projects:

has the entry url format:
  de -&gt; projekte/{slug}    
  en -&gt; projects/{slug}
entry template path:
  projects/_entry


single projectsIndex:

has the entry url format:
  de -&gt; projekte  
  en -&gt; projects
entry template path:
  projects/index


routes:

de -&gt; projekte/(tag)
  template path: projects/index
en -&gt; projects/(tag)
  template path: projects/index


category:

doesn't have a it's own url
category field is marked as translatable


category entries (german version and the english translation):

 - de -&gt; kultur      en -&gt; culture    | (resp. title and slug)
 - de -&gt; industrie   en -&gt; industry   | (resp. title and slug)
 ...


project entries:

 - Entry A:
     de -&gt; category relations ['industrie', 'kultur']
     en -&gt; category relations ['industry']
 - Entry B:
     de -&gt; category relations ['kultur']
     en -&gt; category relations ['culture']


template projects/index.html:

...
{% set _filter = tag|default(null) %}
{% set _category = craft.categories.slug(_filter) %}
...
{% for entry in craft.entries.section('projects').relatedTo(_category) %}
   ...


urls (here comes the trouble):

 - /projekte
     -&gt; lists german version of 'Entry A' and 'Entry B'  (expected)
 - /en/projects
     -&gt; lists english version of 'Entry A' and 'Entry B' (expected)

 - /projekte/kultur
     -&gt; lists german version of 'Entry A' and 'Entry B'  (expected)
 - /en/projects/culture
     -&gt; lists english version of 'Entry A' (NOT expected) and 'Entry B'


...'Entry A' on '/en/projects/culture' shouldn't show up just because there's the 'kultur' category attached to the german version of this entry!

I already tried to explicitly restrict the '_category' by using the '.locale' method but that didn't help either. Now I wonder if I'm doing something fundamentally wrong or if this is a bug by craft itself. 

Any tips are appreciated. 

Thanks

Update: 
Answering my own question here.
To answer my own question see below:

As carlcs pointed out correctly the problem actually isn't located in getting the category - which works just well and is the right way to do it - but in how the relation to the entries is done.


I should check if the tag (coming from the url) actually resolves to a "real" category, otherwise just all entries will be shown.
just handling over the category to the .relatedTo method on craft.entries won't do it because that just fetches all entries related to this category irrespective to its locale - sourceLocale: craft.locale needs to be set.
Still not finished; because we want to "find elements related to the given element, where the given element is the target of the relation" – target in this sense is the category – we need to define it as tagetElement in the relatedTo method.


...

Getting the entries should now look like this:

{% if categories|length %}
    {% set entries = 
              craft.entries.section('projects').relatedTo({
                 targetElement: categories,
                 sourceLocale: craft.locale
              }) 
    %}
    {% for entry in entries %}
    ...
    {% endfor %}
{% endif %}


...

And the actual title of my question should be "How to do category relations with locales" ;)