Are parameters in strings.xml possible? [duplicate]

In my Android app I’am going to implement my strings with internationalization. I have a problem with the grammar and the way sentences build in different languages.

For example:

“5 minutes ago” – English

“vor 5 Minuten” – German

Can I do something like the following in strings.xml?

<string name="timeFormat">{0} minutes ago</string>

And then some magic like

getString(R.id.timeFormat, dynamicTimeValue)

This behaviour would solve the other problem with different word orders as well.

5 Answers
5

Leave a Comment