Jump to content

Variable

{n} is a placeholder where n is an index into an array of replacement values. For instance the string "Hello {0}!" will rendered as "Hello World!" if a 1 element array containing the value "World" is passed into a string replacement function.

Stanley07:17, 10 March 2011

Hi Stanley, thank your for your reply. However I am still confused. Would "Hello {0}s!" be rendered as "Hello Worlds!"? Once in a while I stumble over „{0}s“. Cheers

[[kgh]]18:07, 10 March 2011

Yes, it would be rendered as "Hello Worlds!". Anything between the curly braces would get replaced.

I looked at how one of the messages is used:

Center.hashof=# of active {0}s

The placeholder gets replaced with "Center" and "Group", so the rendered message becomes "# of active Clients" and "# of active Groups". In this example, it is a patchwork message. I suspect the other messages are like that too.

Stanley20:39, 10 March 2011

Thank your for confirming my understanding of this. Luckily I have intuitively translated it as plural. However, this may lead to problems since plural may get complex in some languages, e. g. in German we have „e“, „s“, „en“, etc. Because of that it is imho very important to at least indicate the possible content for the placeholder in the message documentation. I am sure that it is possible to guess the content out of context whilst translating, but guessing always makes me feel unsure in the end. Perhaps there other thoughts on this, too.

[[kgh]]21:16, 10 March 2011