2010-06-10 4 views
7

i18n 국제화를 사용하는 GWT 앱을 개발했습니다. 호스트/Dev 모드에서 제대로 작동하지만 GWT 컴파일을 시작하면 다음과 같은 오류가 발생합니다. 키 xxx에 대한 리소스가 없습니다 (아래 참조).GWT 2.X 키에 대한 리소스가 없습니다.

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 [email protected] 
       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있어서되지 말한다.

도움을 주시면 대단히 감사하겠습니다.

답변

14

국제화를 사용할 때 한 번 비슷한 오류가 발생했습니다. 영어와 폴란드어에 대한 등록 정보 파일은 labels_en.propertieslabels_pl.properties입니다. 해결책은 파일 labels.properties을 작성하는 것이 었습니다 (제 경우에는 labels_en.properties 사본). 이상한데 어떻게 든 도움이되었습니다.

또한 속성 파일은 RTEMessages 클래스와 동일한 패키지에 보관해야합니다.

+1

감사합니다. Google은 쇼케이스 프로젝트를 더 모듈화해야했습니다. 이 코드 스 니펫을 사용하면 이와 같은 종속성으로 인해 매우 불편합니다. – expert

+0

GWT는 특정 로캘 파일에서 키를 찾을 수없는 경우이 파일을 기본값으로 사용합니다. 대안으로 여러분은'@ DefaultMessage'와 인터페이스로 여러분의 메소드에 주석을 달 수 있습니다 – damluar

1

도 2 중요한 일 (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.

관련 문제