2

I've got a list of n people and I would like to construct a sentence like so:

Andrea, Bob, Chelsea, Dan and Emma like this.

This is easy to have in your strings file if the number of people is known beforehand as the format for 5 people is like this:

%@, %@, %@, %@ and %@ like this.

Say we have a variable number of people though and the number of people is determined at runtime and could go up to say 15 (or much more) people. How would you potentially translate all of the different cases in a conventional and non-fragile way, not doing something like this in your strings file and then appending the translations together:

"initialListItem" = "%@, "
"midListItem" = "%@ "
"finalListItem" = "and %@ "
"postludeListItem" = "like this."

Ideally you could define a list format that is automatically expanded based on the number of people in the list, and that is easy for translators to translate. Does something like this exist or is there a way to do this?

djdrzzy
  • 603
  • 4
  • 17

0 Answers0