所以,我想使用poedit翻译WordPress主题和插件。有些字符串使用占位符和%d之类的占位符,有人可以告诉我他们到底是什么?
因为,例如,我有"%D成人"one_answers"%s成人",但我不知道它们之间的区别
这些占位符是Sprintf格式规范的一部分。
简而言之,此功能采用"格式字符串",然后使用一系列值,并创建一个新的字符串,其中提供的值插入格式字符串:
$verse = sprintf('%d bottles of %s on the wall', 99, 'beer');
%d
占位持有人表示它是签名的十进制整数的位置。%s
占位符表示它是字符串的点。
$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.