| ▲ | layer8 2 hours ago | |||||||
> why use format strings Because these are used for locale-specific configuration data. `"This is here: {x+y} blah"` on the other hand isn’t a string (mere data), it’s a program, because you can have arbitrary expressions inside the braces. You don’t want to repeat the `x+y` in each localization file. I have nothing against ergonomic program constructs for composing strings, but please let’s not confuse such program constructs with mere string literals. | ||||||||
| ▲ | zdragnar an hour ago | parent [-] | |||||||
If your string needs to be presented in multiple locales, you probably want to go a step further and use something like the ICU syntax and a proper parser and formatter rather than rely on manually formatting things yourself. Otherwise, that dynamic data is going to give you headaches when you have to deal with plurals and genders and such. | ||||||||
| ||||||||