iklajo, I had more or less the same problem and I solved it this way.
First, I'm not a programmer, I know something about PHP but I'm a graphic designer and - funny - I like designing more for offline projects than online ones

But now I'm working on a website project, probono, so I have a very low budget - in fact no budget at all - and I have to use free solutions or to find solutions by myself.
Well, the problem for me was more or less the same: language switcher's links were ok for pages and single posts, but wrong for category pages with listing of posts.
I use a personal language switcher, I wrote the code by myself but I also tested the standard language switcher and the problem was the same.
My link were ok for slugs translation but wrong for language code. For instance, the italian page for category "notizie" had this language switcher's links:
IT > .../it/category/notizie
FR > .../it/category/informations
EN > ...(it/category/news
I was using this fix:
http://en.codatavern.com/qtranslate-slu ... in-fix/but the problem was still there for category pages...
I continued to use the fixed version of code, but I started to check the code - both qTranslate Slug and Wordpress - and I found that the problem was this.
In
taxonomy.php at a certain point there is the definition of
get_term_link function.
The last line of code for
get_term_link function is this one:
- Code: Select all
return apply_filters('term_link', $termlink, $term, $taxonomy);
This line makes everything going wrong.
qTranslate in fact adds a filter for
term_link so that the last line of code of the
get_term_link function uses the function defined in qTranslate.
But this function doesn't care for language code, so everything is set equal to actual language: IT, in my case.
So I decided to add two lines of code. First, find this code:
- Code: Select all
//Activates filters defined by this module
add_filter('page_link', 'qTranslateSlug_page_link', 0, 2);
add_filter('post_link', 'qTranslateSlug_post_link', 0, 3);
add_filter('category_link', 'qTranslateSlug_category_link', 0, 2);
add_filter('tag_link', 'qTranslateSlug_tag_link');
//add_filter('the_permalink', 'qTranslateSlug_convertURL', 0, 4);
And add this line:
- Code: Select all
add_filter('term_link', 'qTranslateSlug_category_link', 0, 2);
I know that I would have to write an
ad hoc function (i.e.
qTranslateSlug_term_link ) and add that as a filter, but adding
qTranslateSlug_category_link works fine for me so it's ok. If any real - not a fake like me

- programmer wants to write a more efficient code, he's welcome!
The second step is to add a line of code inside
qTranslateSlug_remove_qtrans_filters because if you add a filter for qTranslateSlug you have to remove the corresponding filter set by qTranslate.
So inside this function you add this line of code:
- Code: Select all
remove_filter('term_link', 'qtrans_convertURL');
You're done!
This worked for me, I hope it works for you too.
Or perhaps this is a hint for a better solution.
I also solved a problem with searched results pages because they were ok only for IT pages but not for for EN e FR.
I write the solution for this too, just in case someone else would have the same problem.
Why this problem? Because the link set by the search form was like this:
- Code: Select all
.../it?s=example
where
example is the searched word.
This code works for the main language, but it fails for other languages because they translate to this:
- Code: Select all
.../fr?s=example
- Code: Select all
.../en?s=example
They need a
slash after the language code to work, like this:
- Code: Select all
.../fr/?s=example
- Code: Select all
.../en/?s=example
So also the IT URL must have the
slash, like this
- Code: Select all
.../it/?s=example
to have the correct translation.
I added the
slash in my template search form code and everything is ok.
Sometimes problems can occur because of template code too

Not that the template is wrong by itself, but it doesn't work with slug plugin if you don't add the slash

Now I still have a little problem with category pages because I can see post listed only when I'm on IT page (my default language) and not on FR and EN pages, but I will further investigate because I think this is another kind of problem
maurizio