How to add translation helpers in tag.hbs


I found the Casper-M3 Theme on GitHub and wanted to localize it.

My problem now is that when I try to translate Zero posts and singular and plural of Posts inside tag.hbs the helpers are displayed on my blog.

This is how it’s displayed:

Screenshot 2024-03-10 172728

Here’s a snippet how I tried to solve this:

            <div class="post-card-content">
            <div class="post-card-content-link">
                <header class="post-card-header">
                    <h2 class="post-card-title">{{name}}</h2>
                <div class="post-card-excerpt">
                    {{#if description}}
                        {{t 'A collection of'}} {{plural ../ empty='{{t "Zero posts"}}' singular='% {{t "post_singular"}}' plural='% {{t "post_plural"}}'}}

I’m not a developer and just want to localize it.

Thank you for your help.

You can use this syntax for making string translatable in the {{plural}} helper:

{{plural ../ empty=(t 'No posts') singular=(t '1 post') plural=(t '% posts')}}
1 Like