Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

解决strings.xml格式化占位符错误:Multiple substitutions specified in non-positional format

使用strings.xml进行格式化占位符时报错:

Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute?

检查后发现是格式化字符串中包含多个占位符导致

解决案例:

<string name="test">HomePage: %1$s, Author: %2$s</string>

<string name="order_total_hint">Total %1$d products(including shipping %2$s%3$.2f)</string>
上一篇 Android Cannot call this method while RecyclerView is computing a layout or scrolling
下一篇 GreenDao insert 解决 PRIMARY KEY must be unique