adobe / htl-spec

HTML Template Language Specification
Apache License 2.0
280 stars 146 forks source link

Support arguments in i18n #87

Closed karollewandowski closed 4 years ago

karollewandowski commented 4 years ago

Correct me if I'm wrong, but it looks like it is not possible to pass translation arguments in HTL.

Proposal

Example with single argument

Dictionary entry: user.greeting=Hello {0}! Usage:

${'user.greeting' @ i18n, args='Karol'} <!-- prints: Hello Karol! -->

Example with multiple arguments

Dictionary entry: user.greeting=Hello {0}, you have {1} unread messages. Usage:

${'user.greeting' @ i18n, args=['Karol', 21]} <!-- prints: Hello Karol, you have 21 unread messages. -->
karollewandowski commented 4 years ago

I've just found out it should be done with format option and is even mentioned in specification under format section. I think it would be good to mention it in i18n section as well. My bad, sorry for spam.