Java 本地化xliff错误消息

Java 本地化xliff错误消息,java,android,xml,string,xliff,Java,Android,Xml,String,Xliff,我使用xliff创建了一个资源字符串,但在运行应用程序时出错: Error:(17, 52) Error: The prefix "id" for attribute "id:" associated with an element type "xliff:g" is not bound. Error:Execution failed for task ':app:mergeDebugResources'. > C:\Users\msanli\AndroidStudioProjects\

我使用xliff创建了一个资源字符串,但在运行应用程序时出错:

Error:(17, 52) Error: The prefix "id" for attribute "id:" associated with an element type "xliff:g" is not bound.

Error:Execution failed for task ':app:mergeDebugResources'.
> C:\Users\msanli\AndroidStudioProjects\JustJava\app\src\main\res\values\strings.xml:17:52: Error: The prefix "id" for attribute "id:" associated with an element type "xliff:g" is not bound.
我已经在我的资源附近添加了这个,所以我不确定发生了什么

(xmlns:xliff=“urn:oasis:names:tc:xliff:document:1.2”)。

感谢您的帮助

资源:

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="app_name">Just Java</string>
    <string name="hint_name">Name</string>
    <string name="toppings_header">Toppings</string>
    <string name="whipped_cream">Whipped Cream</string>
    <string name="chocolate">Chocolate</string>
    <string name="quantity_header">Quantity</string>
    <string name="decrement_minus">-</string>
    <string name="quantity_text">1</string>
    <string name="increment_plus">+</string>
    <string name="order_text">Order</string>
    <string name="max_coffee_toast">You cannot have more than 100 cups of coffee</string>
    <string name="min_coffee_toast">You cannot have less than 1 cup of coffee</string>
    <string name="admin_email"></string>
    <string name="email_order_subject">Just Java Order Summary For </string>
    <string name="name_order_summary">
        Name: <xliff:g id:="name" example="Samuel">%s</xliff:g>
    </string>
    <string name="whipped_cream_ordered">Add Whipped Cream? </string>
    <string name="chocolate_ordered">Add Chocolate? </string>
    <string name="quantity">Quantity: </string>
    <string name="total_price">Total Price: $</string>
    <string name="thank_you">Thank You!</string>



</resources>

只是Java
名称
浇头
生奶油
巧克力
量
-
1.
+
命令
你不能喝超过100杯的咖啡
你不能少于一杯咖啡
只是Java订单摘要
名称:%s
加鲜奶油?
加巧克力?
数量:
总价:$
非常感谢。

因此strings.xml中的字符串的行为与常规字符串略有不同。 您需要转义(分隔)某些字符。您可以保存下表

替换的
< 替换>
更换
&用于&
将“
替换为” 替换\“\”的

所以在你的例子中,它是在看“xliff:g”


也要遵循>的步骤。这将解决您的问题。如果没有,请告诉我。

因此strings.xml中的字符串与常规字符串的行为略有不同。 您需要转义(分隔)某些字符。您可以保存下表

替换的
< 替换>
更换
&用于&
将“
替换为” 替换\“\”的

所以在你的例子中,它是在看“xliff:g”


也要遵循>的步骤。这将解决您的问题。如果没有,请告诉我。

您的资源不是有效的XML:请尝试删除
id:=“name”
中的冒号,看看是否有区别

您的资源不是有效的XML:请尝试删除
id:=“name”
中的冒号,看看是否有什么不同

几个小时以来,我一直在与一个非常类似的问题作斗争。
如果使用翻译编辑器为另一种语言生成了strings.xml文件,则还需要在新的xml文件上添加
(xmlns:xliff=“urn:oasis:names:tc:xliff:document:1.2”)
。否则,您将得到一个
元素“xliff:g”的前缀“xliff”未绑定的
错误。我希望这有助于其他可能还在谷歌上搜索的人。

我在几个小时内一直在努力解决一个非常类似的问题。
如果您使用翻译编辑器为另一种语言生成了strings.xml文件,则需要在新的xml文件上添加
(xmlns:xliff=“urn:oasis:names:tc:xliff:document:1.2”)
。否则,您将获得元素“xliff:g”的前缀“xliff”“未绑定”
错误。我希望这有助于其他可能仍在谷歌上搜索此信息的人。

抱歉,我在理解您建议的表时遇到困难…需要转义strings.xml文件中的哪些字符?进行了更改。这应该更有意义。抱歉,我在理解您建议的表时遇到困难…哪些字符需要转义strings.xml文件中的Acter?进行了更改。这应该更有意义。