Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 Android 风格的字符串,大致如下:
You got %1$s questions out of %2$s correctly
如何在 google translate API 中传递此字符串以获取带有占位符的正确翻译字符串?
您可以使用 html5 translate 属性:
You got <i translate="no">%1$s</i> questions out of <i translate="no">%2$s</i> correctly
API 不应翻译 html 标记内的内容。最后,您可以删除在翻译后的字符串中使用正则表达式添加的 html 标记。