Closed MarcVanDaele90 closed 2 years ago
Both work. The %d
will be applied to the translation. For example, using the one on the top, your translations can be:
static var _t = Translations("en_us") +
{
"en_us": "There is 1 item"
.zero("There are no items")
.one("There is 1 item")
.two("There are a couple of items")
.many("There are %d items")
.times(12, "There are a dozen items")
};
As you can see above, only the many
translation uses the %d
.
But you can also use the other one:
static var _t = Translations("en_us") +
{
"en_us": "There is %d item"
.zero("There are %d items")
.one("There is %d item")
.many("There are %d items")
};
Does that answer your question?
The readme on https://github.com/marcglasberg/i18n_extension contains the following examples
print("There is 1 item".plural(0)); // Prints 'There are no items' print("There is 1 item".plural(1)); // Prints 'There is 1 item' print("There is 1 item".plural(2)); // Prints 'There are 2 items'
Shouldn't these be
print("There is %d item".plural(0)); // Prints 'There are no items' print("There is %d item".plural(1)); // Prints 'There is 1 item' print("There is %d item".plural(2)); // Prints 'There are 2 items'
At least, according to my observations, the second form works while the first one doesn't.