Patricia Odermatt
Patricia Odermatt

Reputation: 115

Internationalization in Google Web Toolkit

I want to use the internationalization for my GWT Application.

I read that i need a Languages.properties file in which I write for example ticketHomeSiteLabelDemnaechst="Activities due soon"

a class which i called Languages.java:

import com.google.gwt.i18n.client.Messages;

public interface Languages extends Messages{

    String ticketHomeSiteLabelDemnaechst();
}

applicationname.gwt.xml:

<inherits name='com.google.gwt.i18n.I18N'/>
<extend-property name="locale" values="de"/>
<extend-property name="locale" values="en"/>
<set-property-fallback name="locale" value="en"/>

And in the class where I want to use it:

final Languages language = GWT.create(Languages.class);
    labelDemnaechst.setText(Int.get(language.ticketHomeSiteLabelDemnaechst()));

When I do this:

I get this error: No source code is available for type Languages; did you forget to inherit a required module?

Upvotes: 2

Views: 456

Answers (1)

Colin Alworth
Colin Alworth

Reputation: 18331

The error message indicates that Languages.java may be in the wrong package. Make sure it is in the client package, assuming that is where you keep your other gwt code (the EntryPoint, and whatever the last code snippet came from).

Upvotes: 2

Related Questions