1

So, I want to translate a WordPress theme and plugin using POEDIT. There are some strings that use placeholders like %s and %d, can someone tell me what exactly they stand for?

Because, for example I have "%d Adult" and "%s Adult" but I dont know whats the difference between them

jayrrr
  • 159
  • 1
  • 2
  • 14

2 Answers2

1

Those placeholders are part of the format specification for sprintf.

In short, this function takes a 'format string' and then a series of values and creates a new string with the provided values inserted into format string:

$verse = sprintf('%d bottles of %s on the wall', 99, 'beer');

The %d placeholder indicates that it's a spot for signed decimal integer. The %s placeholder indicates that it's a spot for a string.

Dancrumb
  • 26,597
  • 10
  • 74
  • 130
0
$wpdb->prepare() supports a small subset of the sprintf() arguments. 
        The %d is a placeholder for an integer (not a decimal, that would be %f).
        Use %d when you want to send a real integer to the database,
        Use %s for strings. 
Samyappa
  • 535
  • 2
  • 11