Sadly this only works for English. Of course, given the functional requirements, it's probably fine, but this kind of code exists IRL and it can be annoying to refactor to support more languages.
For example, many languages have grammatical gender and so may also change how the word looks like. Bonus points, when the word body changes. In this example it wouldn't change radically, but the word for a file in German is "die Datei" and the plural is "die Dateien" (although apparently "das File" can be used.)
Okay, this isn't that big of a deal, one might say. You just pack the word's singular and plural with the possible gender, and you're set. But no, because this isn't even the worst part! The simplest complicated case might be that you have a singular, dual, and plural. In some sense this makes sense, since "two" is pretty special in terms of amount of stuff.
But then you get stufi like the following, as documented in [0]:
> Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]
>
> [...]
>
> Languages with this property include:
>
> Slavic family
>
> Russian, Ukrainian, Belarusian, Serbian, Croatian
Or the six form pluralisation found in Arabic.
So yeah, this sort of "complicated" pluralisation isn't just an issue if you're trying to support some comparatively very niche languages, but this is a thing one needs to think about when supporting many major world languages.
And of course, how you inflect the noun you're pluralising depends on the context of the sentence and the relevant grammar. For example, the form might change if you're at a place that expects a noun in its nominative versus accusative form. And of course, there's the order of words, and so muth more, that could be mentioned.
So yeah, natural language is difficult. Not quite Turing complete, but good localisation takes a lot of effort.
[0]: https://www.gnu.org/software/gettext/manual/html_node/Plural...