News for hackers. Stuff that matters.
Re:Yagni Exceptions (2021) by iLoveOncall on Monday October 17, 2022 @07:41AM (#33232228)
Your function doesn't solve any of the issues I mentioned, you still need to switch to another file, still need to think of a sufficiently explicit key, still need to handle plurals and masculine / feminine variations, etc.
Re:Yagni Exceptions (2021) by matsemann on Monday October 17, 2022 @08:06AM (#33232411)
YAGNI ;) You can skip all those things the first time. You don't need to have a separate file or anything. Just have a stupid function returning its input or whatever. The important part is having an entry-point, and an easy way to find all relevant uses in the future. You could then later, when i18n is needed, write a script finding those usages and automatically extract them. That's what I've done once before. And it was a thousand times easier than the time before where we had to hunt through all of frontend, backend, cms etc. to find stuff.
Re:Yagni Exceptions (2021) by iLoveOncall on Monday October 17, 2022 @08:48AM (#33232743)
> The important part is having an entry-point, and an easy way to find all relevant uses in the future.

You already have it, it's everything that's in between {{ }} and > </.

Re:Yagni Exceptions (2021) by matsemann on Monday October 17, 2022 @09:47AM (#33233414)
Do you want to translate numbers between ><? What about alt-texts not in those tags? Things passed as props multiple layers? What about strings coming from backend? Do you read some things from the environment?