Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Translate Months (low_yearly_archives)

Status Resolved
Add-on / Version Publisher 1.5.8
Severity Trivial
EE Version 2.8.1

Niall O'Brien

Nov 26, 2014

Hi, this is a similar issue to https://boldminded.com/support/ticket/561 however, nothing I try will resolve my issue. Here’s the part of my template in question.

{exp:low_yearly_archives channel="news" sort="desc"}
                    {if entries_in_year > 0}
                    <dd class="show-for-medium-up {if year_count==1}active{/if}">
                        <a href="#panel{year_count}">{year}</a>

                        <div id="panel{year_count}" class="content {if year_count==1}active{/if}">
                            <ul>
                                {months}
                                {if num_entries > 0}
                                <li>
                                    <a href="{root_url}news/{year}/{month_num}">{exp:publisher:translate_phrase name="{month_num}"}  - ({num_entries})</a>
                                </li>
                                {/if}
                                {/months}
                            </ul>
<p>                        </p>
</div>
<p>                        {if year_count == total_years}<br />
                    </p>
</dd>
<p>                    {/if}<br />
                    {/if}<br />
                    {/exp:low_yearly_archives}

In the backend, I’m translating {month_num} into the corresponding months, eg. 07 = July.
This works if I hardcode 07 in place of {month_num}, but when {month_num} is in place, it just outputs that tag.

I also tried {month} (which outputs July) but I can see in mod.publisher.php on line 473 that you’re converting it to lower case, so a phrase called “july” should work, however, none of these are working for me. Is there an issue with the parse order here?

Thanks in advance.

#1

BoldMinded (Brian)

Did you try parse=”inward”? {month_num} is a variable created by the yearly_archives tag, so it might not be printing the correct value by the time the translate_phrase tag is called.

#2

Niall O'Brien

Hi, thanks for your reply. I got around it by putting it into a partial and embedding the partial in the main template (passing month_num as a var to the partial) thereby ensuring it was parsed before handing it to translate_phrase (I setup 01-12 as phrases as it worked better than using {month}).

template.html

{embed="news/translate-month" month_name="{month_num}"}

news.group/translate-month.html

{exp:publisher:translate_phrase name="{embed:month_name}"}

Thanks.

#3

BoldMinded (Brian)

Glad you found a work around.

Login to reply