I18N Message : I18N « GWT « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JDK 7
27.JNDI LDAP
28.JPA
29.JSP
30.JSTL
31.Language Basics
32.Network Protocol
33.PDF RTF
34.Reflection
35.Regular Expressions
36.Scripting
37.Security
38.Servlets
39.Spring
40.Swing Components
41.Swing JFC
42.SWT JFace Eclipse
43.Threads
44.Tiny Application
45.Velocity
46.Web Services SOA
47.XML
Java » GWT » I18N 




I18N Message


package com.java2s.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.RootPanel;


public class GWTClient implements EntryPoint{

  public void onModuleLoad() {
    MenuBar menu = new MenuBar();
    
    MenuBar menuCreate = new MenuBar(true);
    MenuBar menuHelp = new MenuBar(true);
        
    Constants constants = (ConstantsGWT.create(Constants.class);
           
    menuHelp.addItem(constants.AboutMenuItemName()new DummyCommand());
            
    menuCreate.addItem(constants.ClockMenuItemName()new DummyCommand());
    menuCreate.addItem(constants.CalculatorMenuItemName()new DummyCommand());
    menuCreate.addItem(constants.permissionDenied("Joe","your password is wrong")new DummyCommand());

    menu.addItem(constants.HelpMenuName(), menuHelp);
    menu.addItem(constants.CreateMenuName(), menuCreate);




    menuCreate.addStyleName("submenu");
    menuHelp.addStyleName("submenu");

    RootPanel.get().add(menu);
  }
}

    public class DummyCommand implements Command{
      public void execute() {
        Window.alert("Menu Item Clicked");
    }
    }
/////
package com.java2s.gwt.client;

public interface Constants extends com.google.gwt.i18n.client.Messages {
    /**
   * Translated "About".
   
   @return translated "About"
   * @gwt.key AboutMenuItemName
   */
  String AboutMenuItemName();

  /**
   * Translated "Create".
   
   @return translated "Create"
   * @gwt.key CreateMenuName
   */
  String CreateMenuName();

  /**
   * Translated "Help".
   
   @return translated "Help"
   * @gwt.key HelpMenuName
   */
  String HelpMenuName();

  /**
   * Translated "Calculator".
   
   @return translated "Calculator"
   * @gwt.key CalculatorMenuItemName
   */
  String CalculatorMenuItemName();

  /**
   * Translated "Clock".
   
   @return translated "Clock"
   * @gwt.key ClockMenuItemName
   */
  String ClockMenuItemName();
  
  
    
  String permissionDenied(String name, String message);
}
//////////////
HelpMenuName: Help
CreateMenuName: Create
AboutMenuItemName: About
CalculatorMenuItemName: Calculator
ClockMenuItemName: Clock
permissionDenied = Hi {0}{1}

           
       














GWT-I18NMessage.zip( 4 k)
Related examples in the same category
1.Fill I18N Message to MenuItem
2.Load String From Properties File
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.