3 ms·
There is a few libraries that can do some work around localization and formatting, though IIRC most commonly if you need something translated, you just turn it
by zaarn 5y ago
There is a few libraries that can do some work around localization and formatting, though IIRC most commonly if you need something translated, you just turn it into a format argument as well. So instead of say "hello {name}", you write "{greeting} {name}" (though this doesn't cover all languages anyway).
edit: There is also the issue that on some platforms (Linux) locale has some soundness issues (not a fault of rust) and yet on others it can be hard to use locales properly (Windows can introduce some hard locale weirdness)
- Someone 5y agoThat doesn’t work if you have to change word order. A format string {a} foo bar {b} Might have to be translated as Baz {b} {a} quux (Also notice that, in the first sentence, you might want to capitalize {a}. That’s complicated in itself. Localization is a rat’s nest. I don’t think you can expect any automated system to do it perfectly)
- zaarn 5y agoI've already mentioned this won't cover all languages.