X找不到密钥的资源

X找不到密钥的资源

本文介绍了GWT 2.X找不到密钥的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've developed a GWT app using i18n internationalization. In Host/Dev mode it works fine, but launching GWT compile gives this error: No resource found for key xxx, like below.

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'


$ b

Messages are loaded with late binding.

public class RTEValidationMessages {
    private RTEMessages additionalMessages;

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

删除给出错误的方法,随机方法错误,说没有方法之前或之后的接口... client.i18n.RTEMessages。

Deleting the method which gives the error, results in another random method with error, say not the method before or after in the interface ...client.i18n.RTEMessages.

帮助非常感谢。

推荐答案

在使用国际化时,我曾经遇到类似的错误。我有英语和波兰语的属性文件: labels_en.properties labels_pl.properties 。解决方案是创建一个文件 labels.properties (在我的情况下,它只是一个 labels_en.properties )。

I had a similar error once when using internationalization. I had properties files for English and Polish languages: labels_en.properties and labels_pl.properties. The solution was to create also a file labels.properties (in my case it was just a copy of labels_en.properties). It is weird but somehow it helped.

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

You should also keep your properties files in the same package as your RTEMessages class.

这篇关于GWT 2.X找不到密钥的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 16:19