gettext-rs provides a number of macros, of all which support {} for variable substitution, and some support {n} too. However, this support is coded such that unsupported stuff (e.g. {variable}, {:.3}, {:x}) passes through unchanged.
This is a problem because it makes introduction of new specifiers a breaking change. Users might already have strings with e.g. {:x}, and they rely on gettext-rs printing out {:x} in this case. We'd break that expectation if we added support for {:x}.
This is also inconsistent with how format! works: it always consumes anything that looks like a format specifier, and gives a compile-time error if the specifier is not supported (e.g. {:foobar}).
gettext-rs
provides a number of macros, of all which support{}
for variable substitution, and some support{n}
too. However, this support is coded such that unsupported stuff (e.g.{variable}
,{:.3}
,{:x}
) passes through unchanged.This is a problem because it makes introduction of new specifiers a breaking change. Users might already have strings with e.g.
{:x}
, and they rely ongettext-rs
printing out{:x}
in this case. We'd break that expectation if we added support for{:x}
.This is also inconsistent with how
format!
works: it always consumes anything that looks like a format specifier, and gives a compile-time error if the specifier is not supported (e.g.{:foobar}
).I suggest we mimic std's behaviour.