开发者

GWT 2.X No resource found for key

开发者 https://www.devze.com 2023-01-03 04:56 出处:网络
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.

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'

Messages are loaded with late binding.

public class RTEValidationMessages {
    private RTEMessages additionalMessages; 

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

Deleting the method which gives the error, results in another random method with error, say not the method befor开发者_Go百科e or after in the interface ...client.i18n.RTEMessages.

Help is greatly appreciated.


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.

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


also 2 important things (see docs):

In order to use internationalized characters, make sure that your host HTML file contains the charset=utf8 content type in the meta tag in the header:

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

You must also ensure that all relevant source and .properties files are set to be in the UTF-8 charset in your IDE.

0

精彩评论

暂无评论...
验证码 换一张
取 消