我正在使用根据 google 的翻译服务准备的 strings.xml 文件,该文件指定您不想翻译的字符串部分应包含在 xliff:g 标记中,如下所示:<xliff:g>some text</xliff:g>
例如,我的 strings.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:xliff="rn:oasis:names:tc:xliff:document:1.2">
<string name="game_starts_now">Game Starts Now</string>
<string name="game_starts_in">Game Starts In <xliff:g id="seconds" example="20">{0}</xliff:g> seconds</string>
</resources>
如果我通过搜索名称“game_starts_now”来追踪第一个值,它会按预期追踪,但如果我追踪“game_starts_in”,它会给出它存在的完整 xml 节点。
例子:
trace((xml.string.(@name == "game_starts_now"))); // Game Starts Now
trace((xml.string.(@name == "game_starts_in"))); // [output is next 4 lines]
// <string name="game_starts_in" xmlns:xliff="rn:oasis:names:tc:xliff:document:1.2">
// Game Starts In
// <xliff:g id="seconds" example="20">{0}</xliff:g>
// </string>
有没有办法获得<string>
没有子节点的完整内部文本?我想让第二个跟踪输出以下文本:
Game Starts In {0} seconds