Interpolated strings
Nick Treleaven via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 21 07:46:57 PDT 2017
On Thursday, 20 April 2017 at 20:43:35 UTC, H. S. Teoh wrote:
> If you're doing internationalization, though, neither option is
> a good one (I gave an example using dates in another post):
> printf-style formats have ordering issues (is it year first,
> then month, then day? Or month first then day then year? Which
> argument is which?), and interpolated strings have the problem
> of exposing variable names to the translators (who are probably
> non-coders), potentially opening up the possibility of
> arbitrary code execution via l10n strings.
This is machine checkable though, the translation code could at
least check that the interpolated strings in the translations
match the source string's interpolations (possibly in a different
order).
An issue remaining is: if successive interpolated values depend
on the order they are evaluated in, translations can still cause
bugs (when they change the order).
More information about the Digitalmars-d
mailing list