Has anybody experience with i18n and parameters? E.g. translating the string "I have 7 cars". where "7" is a variable that is determined at runtime?
The "tr" doesn't have any parameters as far as I can see. How is this done?
r
Robert Jaros
02/16/2021, 2:54 PM
tr()
is just an simple alias for
<http://I18n.tr|I18n.tr>()
, but there is also
I18n.ngettext(...)
for your use case.
j
jschneider
02/16/2021, 2:56 PM
If I understand this will just return singular/plural. But how can I add additional parameters.
E.g.: "Your name is Robert" - where "Robert" is only known at runtime.
r
Robert Jaros
02/16/2021, 3:02 PM
I see what you mean
Robert Jaros
02/16/2021, 3:04 PM
It should be implemented but it's not 😞
Robert Jaros
02/16/2021, 3:06 PM
In JS you can just add a parameter, but in Kotlin you can't. I should create a vararag version. So please fill an issue.