2

我有一个 Android 风格的字符串,大致如下:

You got %1$s questions out of %2$s correctly

如何在 google translate API 中传递此字符串以获取带有占位符的正确翻译字符串?

4

1 回答 1

0

您可以使用 html5 translate 属性:

You got <i translate="no">%1$s</i> questions out of <i translate="no">%2$s</i> correctly

API 不应翻译 html 标记内的内容。最后,您可以删除在翻译后的字符串中使用正则表达式添加的 html 标记。

于 2019-10-04T14:35:24.653 回答