Wordpress i18n将变量字符串嵌入到翻译字符串
我正在编写一个需要i18n就绪的自定义插件,因此有一个数组,其中有一些字符串需要翻译:Wordpress i18n将变量字符串嵌入到翻译字符串,wordpress,internationalization,Wordpress,Internationalization,我正在编写一个需要i18n就绪的自定义插件,因此有一个数组,其中有一些字符串需要翻译: array( 'description' => __('Recommended image width is %s and height is %s', get_option('my_image_width'), get_option('my_image_height'), 'my_domain') ); 似乎my_image\u width和my_image\u height的值没有嵌入到文
array(
'description' => __('Recommended image width is %s and height is %s', get_option('my_image_width'), get_option('my_image_height'), 'my_domain')
);
似乎
my_image\u width
和my_image\u height
的值没有嵌入到文本中,也没有替换%s
,我该怎么做呢?威尔,我刚想出来,使用sprintf函数:
array(
'description' => sprintf( __('Recommended image width is %s and height is %s', 'my_domain'), get_option('my_image_width'), get_option('my_image_height') )
);