4 ms·
> Killing format strings makes l10n much harder. Wow I'm not sure who posted this comment but they got it exactly backwards. Format strings being easy to use
by masklinn 9y ago
> Killing format strings makes l10n much harder.
Wow I'm not sure who posted this comment but they got it exactly backwards.
Format strings being easy to use (and the alternatives often being non-existent) make it very likely to have shit l10n, because most every culture needs their own format string so you'll have to fuck it up for each and every culture before being corrected (if you ever are).
Despite there being an entire organisation dedicated to — amongst others — collating and encoding locale-dependent date and time formats: https://www.unicode.org/cldr/charts/33/by_type/date_&_time.gregorian.html#Formats_-_Standard_-_Date_Formats https://www.unicode.org/cldr/charts/33/by_type/date_&_time.g... (warning: humongous page)
Datetime format strings need to exist as the underlying low-level API for these, but the average developer, the developer who is not working on a datetime parsing or formatting library, should not have to ever write a "raw" datetime format string.
Sadly even in the best of world they'll have to deal with inane datetime format created or specified by some coked-up aye-aye, but that's basically the exception.
- hyperman1 9y agoI wonder if this isn't an out of place recitation of a correct argument: Format strings that allow you to reorder arguments are a godsend. I can use printf in c with a translation bundle, and reorder the arguments as my language needs: printf("second is %2$d and first is %1$d",first,second); Compare with cout<<args; there is much less influence you can exercise. So taking this capability away makes l10n harder. But this is an other kind of format string. In Java there is the MessageFormat API. It can do almost everything l10n requires, at the price of perl-like format string complexity.
- masklinn 9y agoAn interesting point, that might be it.