GWT 2.X找不到密钥的资源

时间:2010-06-10 15:15:31

标签: compiler-construction gwt

我使用i18n国际化开发了一个GWT应用程序。在主机/开发模式下它工作正常,但启动GWT编译会出现此错误:找不到密钥xxx的资源,如下所示。

Compiling module ...rte.RTE
   Scanning for additional dependencies: file:/home/.../client/i18n/RTEValidationMessages.java
      Computing all possible rebind results for '...client.i18n.RTEMessages'
         Rebinding ...client.i18n.RTEMessages
            Invoking com.google.gwt.dev.javac.StandardGeneratorContext@e7dfd0
               Processing interface ...client.i18n.RTEMessages
                  Generating method body for txtIndirizzo3()
                     [ERROR] No resource found for key 'txtIndirizzo3'

邮件加载了后期绑定。

public class RTEValidationMessages {
    private RTEMessages additionalMessages; 

    public RTEValidationMessages() {
        additionalMessages = GWT.create(RTEMessages.class);
    }
}

删除给出错误的方法会产生另一个带错误的随机方法,比如说在接口之前或之后的方法...不是... client.i18n.RTEMessages。

非常感谢帮助。

2 个答案:

答案 0 :(得分:14)

使用国际化时,我遇到过类似的错误。我有英语和波兰语的属性文件:labels_en.propertieslabels_pl.properties。解决方案是创建一个文件labels.properties(在我的例子中,它只是labels_en.properties的副本)。这很奇怪但不知何故有所帮助。

您还应该将属性文件保存在与RTEMessages类相同的包中。

答案 1 :(得分:1)

还有两件重要的事情(见docs):

  

为了使用国际化   字符,请确保您的主机   HTML文件包含charset = utf8   中的元标记中的内容类型   头:

<meta http-equiv="content-type" content="text/html;charset=utf-8" />
     

您还必须确保所有相关内容   source和.properties文件已设置   在你的UTF-8字符集中   IDE。