code icon indicating copy to clipboard operation
code copied to clipboard

Misspelling on Reports page

Open w26ad opened this issue 1 year ago • 4 comments

Describe the bug

It should be 1 'message' instead of 'messages' edited_YNLEWXAhCD

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

w26ad avatar May 03 '24 21:05 w26ad

Can I be assigned this issue?

Martins100-Tmd avatar Jul 30 '24 15:07 Martins100-Tmd

I'm probably overthinking, but I see three ways we could fix this (in order of least preferred to most preferred):

  1. Replace "messages" with "message(s)"
  2. Make a utility function to make words plural as necessary, such as the one below
function pluralize(count: number, singular: string, plural: string = `${singular}s`) {
  return `${count} ${count === 1 ? singular : plural}`;
}

console.log(pluralize(0, "message")); // 0 messages
console.log(pluralize(1, "message")); // 1 message
console.log(pluralize(2, "message")); // 2 messages
console.log(pluralize(1, "life", "lives")); // 1 life
console.log(pluralize(2, "life", "lives")); // 2 lives
  1. Use translations. I'm not sure how well the effort to do localization is going, but this option would be the long-term goal in my mind.

piprett avatar Dec 12 '24 17:12 piprett

if you localize these messages, vintl has a special syntax for pluralizing things in an i18n-friendly way

Prospector avatar Dec 12 '24 17:12 Prospector