GWT: i18n internationalization

To create an internationalization functionality in a GWT application: 1. Create an Interface for all front-end strings:

package com.ucc.csd.client;

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

public interface I18nConstants extends Constants

{

    String imageViewPath();

}

2. Create a "i18nConstants.properties" file in the client package (com.xyz.zyx.client)

# PROD

#imageViewPath = http://communitysportsdesk.com/csd_images/ 

# UAT

#imageViewPath = http://64.191.235.56/csd_images/ 

# Uki

imageViewPath = http://localhost:8282/csd_images/

# Zainab, Trevor, Phil

#imageViewPath = http://localhost:8080/csd_images/

3. Create a class variable for the i18n Interface:

private I18nConstants i18n;

4. Generate GWT implementation for it, in the class constructor:

i18n = (I18nConstants) GWT.create(I18nConstants.class);

5. Call it as needed:

setImageViewPath(i18n.imageViewPath());



As an Amazon Associate I earn from qualifying purchases.

No comments:

Post a Comment

Post Scriptum

The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar

Popular Recent Posts

Most Popular Articles

apt quotation..