# Js.filters.latest.title - incomplete pluralization in Transifex

**URL:** <https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116>\
**Category:** Bug\
**Created:** [2015年十月4日 12:15 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116 "2015-10-04T12:15:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年十月4日 12:15 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116/1 "2015-10-04T12:15:33Z")

</div>

Even though all related translations are in place in Transifex:

 ![](https://global.discourse-cdn.com/meta/original/3X/9/4/946afc36b95a1fe3098659bf7a0735bbb649896a.png)

… the “zero” translation is not used:

 ![](https://global.discourse-cdn.com/meta/original/3X/3/d/3db853374b05a4dd2b0ff0d0e7e2264acb383d2a.png)

I suspect the issue here is that the `js.filters.latest.title` key has incomplete pluralization and thus is treated by Transifex as 3 separate keys:

`js.filters.latest.title.zero`  
`js.filters.latest.title.one`  
`js.filters.latest.title.other`

The `few` key is missing.

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2015年十月5日 10:03 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116/2 "2015-10-05T10:03:59Z")

</div>

> [@meglio](#):
>
> I suspect the issue here is that the js.filters.latest.title key has incomplete pluralization and thus is treated by Transifex as 3 separate keys

Yes, you’re right. And there are a bunch more with the same issue. I fixed most of them in [PR 3817](https://github.com/discourse/discourse/pull/3817), but there are still some unresolved ones:

- `js.filters.latest.title`
- `js.filters.unread.title`
- `js.filters.new.title`
- `js.filters.category.title`

I didn’t fix them because those keys are heavily used in JavaScript and Ruby and I was under the false impression that pluralization doesn’t make sense in those cases anyway.  
@eviltrout Your weren’t happy about my last changes to the templates. How would you like to fix the pluralizations in this case?

---

<div class="post-metadata">

**Author:** ![axp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/axp/32/116685_2.png) [@axp](https://meta.discourse.org/u/axp)\
**Post date:** [2015年十月24日 15:46 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116/3 "2015-10-24T15:46:17Z")

</div>

Any updates on this? Will it be fixed in near future? Really annoying in non-english forums 😥

---

<div class="post-metadata">

**Author:** ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
**Post date:** [2015年十一月9日 19:34 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116/4 "2015-11-09T19:34:09Z")

</div>

Can you remind me what needs to change in the template for this to work? It has been some time and I can’t seem to figure it out.

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2015年十一月9日 20:45 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116/5 "2015-11-09T20:45:21Z")

</div>

As you can see in my [PR 3817](https://github.com/discourse/discourse/pull/3817) I had to add a few conditional statements to some templates.

Before:

> <https://github.com/discourse/discourse/blob/4de412365e12e6ad978147c7be23f9e36978f918/app/assets/javascripts/admin/templates/modal/admin_badge_preview.hbs#L17-L18>

After:  
[https://github.com/gschlager/discourse/blob/1e6ff9a83a8c154045a7af28f8d9c0533c90bd15/app/assets/javascripts/admin/templates/modal/admin\_badge\_preview.hbs#L17-L23](https://github.com/gschlager/discourse/blob/1e6ff9a83a8c154045a7af28f8d9c0533c90bd15/app/assets/javascripts/admin/templates/modal/admin_badge_preview.hbs#L17-L23)

I didn’t fix the remaining four translation keys since they probably need some changes to templates as well and you expressed your [concern about those changes in your comment](https://github.com/discourse/discourse/pull/3817#issuecomment-143792637):

> The client templates seem to be quite a bit longer with this patch and I thought zero was a nice feature.

Finding all occurrences of those `js.filters` keys seemed like a lot of work and I wasn’t sure if you even wanted me to change the templates the way I did.

What I need from you in order to finish my PR:

- A decision regarding my template changes. Are they fine or should I solve this e.g. by using some kind of additional parameter with the `i18n` method?
- Maybe some hints where the `js.filters` keys are used. Looks like the keys are concatenated most of the time which makes them hard to find.

---

<div class="post-metadata">

**Author:** ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
**Post date:** [2015年十一月10日 21:32 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116/6 "2015-11-10T21:32:19Z")

</div>

Thanks for patience with me on this one! It has lasted so much time I’d forgotten some details.

> [@gerhard](#):
>
> Are they fine or should I solve this e.g. by using some kind of additional parameter with the i18n method?

1. Having reviewed everything I think your template approach is best. Sorry for the runaround but I think it makes the most sense even if it adds a bunch of logic.

2. That filter text is built programatically which is unfortunate. I think the following `git grep` shows most of the locations:

```sh
git grep "I18n.t([\"']filters"
app/assets/javascripts/discourse/components/navigation-item.js.es6: return I18n.t("filters." + name.replace("/", ".") + ".help", extra);
app/assets/javascripts/discourse/components/topic-post-badges.js.es6: link(buffer, this.get('unseen'), url, 'new-topic', 'new', I18n.t('filters.new.lower_title'));
app/assets/javascripts/discourse/helpers/period-title.js.es6: const title = I18n.t('filters.top.' + (TITLE_SUBS[period] || 'this_week'));
app/assets/javascripts/discourse/models/nav-item.js.es6: return I18n.t("filters." + name.replace("/", ".") + ".title", extra);
app/assets/javascripts/discourse/routes/build-category-route.js.es6: const filterText = I18n.t('filters.' + filter.replace('/', '.') + '.title', { count: 0 }),
app/assets/javascripts/discourse/routes/build-category-route.js.es6: return I18n.t('filters.with_category', { filter: filterText, category: category.get('name') });
app/assets/javascripts/discourse/routes/build-topic-route.js.es6: const filterText = I18n.t('filters.' + filter.replace('/', '.') + '.title', {count: 0});
app/assets/javascripts/discourse/routes/build-topic-route.js.es6: return I18n.t('filters.with_topics', {filter: filterText});
app/assets/javascripts/discourse/routes/discovery-categories.js.es6: return I18n.t("filters.categories.title");

```

---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [2016年七月28日 11:16 UTC](https://meta.discourse.org/t/js-filters-latest-title-incomplete-pluralization-in-transifex/34116/7 "2016-07-28T11:16:24Z")

</div>


