TinyChan

Topic: TinyChan devs

+Anonymous A10 months ago #66,409

With all due respect to the developer… does it annoy anybody else that this website says "1 visits" instead of "1 visit" when you make a new post?
Poll option Votes Percentage Graph
Yes117%
No583%
Why is zero plural?-0%
You need more posts to be allowed to vote.

+Anonymous B10 months ago, 1 minute later[T] [B] #661,826

MS-DOS did that back in the day. 1 files. I think they changed it to file(s).

·Anonymous A (OP) — 10 months ago, 7 minutes later, 9 minutes after the original post[T] [B] #661,829

@previous (B)
> MS-DOS did that back in the day. 1 files. I think they changed it to file(s).

My operating system is English.

+Anonymous C10 months ago, 11 hours later, 11 hours after the original post[T] [B] #661,887

At least it's not "An UID".

+Anonymous D10 months ago, 1 hour later, 13 hours after the original post[T] [B] #661,891

It's too autistic to fix it…
n=>n+" visit"+(n===1?"":"s");
n=>`${n} visit${n===1?"":"s"}`;

Some other languages don't even have a plural form for nouns, thankfully I guess (is that a good thing)?

·Anonymous C10 months ago, 9 minutes later, 13 hours after the original post[T] [B] #661,893

@previous (D)
> It's too autistic to fix it…
Wouldn't a simple if/else do it? The whole site is in English so we don't need to worry about other languages that lack plural forms, and the minimum count will always be 1 since OP is redirected to the thread after posting so they'll always be registered as the first view.

(Edited 29 seconds later.)


·Anonymous D10 months ago, 51 minutes later, 14 hours after the original post[T] [B] #661,897

@previous (C)
> Wouldn't a simple if/else do it?
Too verbose, can't be used as an inline expression either (some other programming languages can).
Also:
function pluralize(singular,times){
  if(times==1)return singular;
  return singular+"s";
}

Please beware of irregular and uncountable nouns (there's a library for that).

(Edited 7 minutes later.)

·Anonymous D10 months ago, 44 minutes later, 14 hours after the original post[T] [B] #661,900

var nouns={
    "person":"people",
    "child":"children",
    "man":"men",
    "woman":"women",
    "tranny":"trannies",
    "foot":"feet",
    "die":"dice",
    "pass":"passes"
};
function pluralize(string){
    return string.replace(/(\w+)([^\w]*)$/,(match,word,extra)=>{
        var plural=nouns[word.toLowerCase()]||word+"s",
            final=word===word.toUpperCase()?plural.toUpperCase():(word[0]===word[0].toUpperCase()?plural[0].toUpperCase()+plural.slice(1):plural); //preserve original capitalization
        return final+extra;
    });
}
console.log(pluralize("Straight man ")+"will self-insert themselves as "+pluralize("the Beautiful Woman... ")); //use case example

+Anonymous E10 months ago, 6 hours later, 21 hours after the original post[T] [B] #661,926

@661,897 (D)
In ES6 you could make that a one liner

const pluralize = (singular, times) => singular + (times === 1 ? "" : "s");
:

You are required to fill in a captcha for your first 5 posts. Sorry, but this is required to stop people from posting while drunk. Please be responsible and don't drink and post!
If you receive this often, consider not clearing your cookies.



Please familiarise yourself with the rules and markup syntax before posting.