As I thought, I’m here again…
The client has now decided that they want category names to also language switch too, even though they insisted they wouldn’t need that when I began.
I’m struggling with implementing category language switching and would appreciate some help, rather urgently in fact!
I have the following code in my templates to output the list of categories, as well as also display the list of entries within each category. Further, there are conditionals in there too to conditionally display entries only if you’re actually viewing that category.
I’ll simplify it next, but just wanted to show what I’ve actually got in there first:
<ul class="sidenav">
{exp:weblog:categories weblog="products" style="linear"}
<li {if "{segment_2}" == "C{category_id}" OR "{segment_3}" == "{category_id}"}class="subcurrent"{/if}><a href="{path=products}">{category_name}</a>
{if "{segment_2}" == "C{category_id}" OR "{segment_3}" == "{embed:cat}"}
<ul>
{exp:weblog:entries weblog="products" category="{category_id}" dynamic="off"}
{if "{embed:current}" != "{url_title}"}<li><a href="{homepage}products/{url_title}/{category_id}/">{title}</a></li>{/if}
{if "{embed:current}" == "{url_title}"}<li><span>{title}</span>{/if}
{/exp:weblog:entries}
</ul>
{/if}
</li>
{/exp:weblog:categories}
</ul>
I suppose broken down to brass tacks it’s simply this:
{exp:weblog:categories weblog="products" style="linear"}
<li><a href="{path=products}">{category_name}</a>
<ul>
{exp:weblog:entries weblog="products" category="{category_id}" dynamic="off"}
<li><a href="{homepage}products/{url_title}">{title}</a></li>
{/exp:weblog:entries}
</ul>
</li>
{/exp:weblog:categories}
Now, following Mark’s instructions I’ve done the following to the above:
{exp:weblog:categories weblog="products" style="linear"
category_group="{exp:translator:simple category_group="2"}"}
as the category group is 2. The category name is ‘Products’.
I’ve now created a new category group called ‘Products_fr’ (which has a group id of 3). However, when I switch languages (to French, using a _fr suffix) no categories whatsoever are output to the page.
I think I might be able to see why, but I just cannot figure out the solution.
Any help very very much appreciated : )
Dave