17: Localize Unit of Remaining

Localize unit of remaining as singular.

  1. Define pluralize filter to controller element by x-filters directive.
  2. Hydrate unit of remaining by pluralize filter.

<body>
  <section class="todoapp"




    x-filters="{
      pluralize (count, word) {
        return word + (count === 1 ? '' : 's')
      },
    }"
  ::>


    <footer class="footer">
      <span class="todo-count">
        <strong x-text="remaining"></strong> items{{ remaining |> pluralize('item') }} left
      </span>

    </footer>
  </section>
</body>
</html>