Wednesday, March 25, 2009

GWT Internationalization

I find a good explain about GWT internationalization at http://markmail.org/message/kkve5qmokt6lixub

Below is the notes get from the post:


 

Here are my own notes to set up Internationalization (i18n) in GWT.


 

1. In myApp.gwt.xml


 

<inherits name="com.google.gwt.i18n.I18N"/>

<extend-property name="locale" values="en"/>

<extend-property name="locale" values="sp"/>

<extend-property name="locale" values="fr"/>


 

2. Create 3 properties files in the client folder:


 

MyMessages_en.properties

MyMessages_fr.properties

MyMessages_sp.properties


 

3. Here is the content of MyMessages_en.properties (the other two

files should be identical):


 

enBtn = English

spBtn = Espa&ntilde;ol

frBtn = Fran&ccedil;ais


 

4. Create 3 Button Widgets in the EntryPoint module


 

MyMessages myMessages = (MyMessages) GWT.create(MyMessages.class);


 

Button enBtn = new Button();

enBtn.setHTML(myMessages.enBtn());


 

Button enBtn = new Button();

enBtn.setHTML(myMessages.frBtn());


 

Button enBtn = new Button();

enBtn.setHTML(myMessages.spBtn());


 

5. Create the MyMessages.java in the client folder:


 

package com.myApp.client;


 

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


 

public interface MyMessages extends Messages {

    String spBtn();

    String enBtn();

    String frBtn();

}


 

6. Here is the ClickListener for one of the buttons:


 

enBtn.addClickListener(new ClickListener() {

    public native void onClick(Widget sender) /*-{

     var currLocation = $wnd.location.toString().split("?");

     var currLocale = "?locale=en";

     $wnd.location.href = currLocation[0] + currLocale;

     $wnd.location.replace(currLocation[0] + currLocale);

     }-*/;

});


 

7. Don't forget this meta tag in the main html file:


 

<meta name="gwt:property" content="locale=en">


 

8. Here is how to manually check that the locale are indeed changed:


 


http://localhost:8888/com.myApp.myProject/myProject.html?locale=en

or


http://localhost:8888/com.myApp.myProject/myProject.html?locale=sp

or


http://localhost:8888/com.myApp.myProject/myProject.html?locale=fr


 

Well. That's it. I believe there are enough information in this post

to start the ball rolling for anyone interested to learn how to

internationalize his/her GWT application.


 

Cheerio.


 


 

Thursday, March 19, 2009

Saving and deleting audit journal receivers

This topic describes how to save and delete audit journal receivers, explains why it is important, and provides step-by-step instructions.

Purpose:

To attach a new audit journal receiver; to save and delete the old receiver

How to:

  • CHGJRN QSYS/QAUDJRN
  • JRNRCV(*GEN) SAVOBJ (to save old receiver)
  • DLTJRNRCV (to delete old receiver)

Authority:

*ALL authority to journal receiver; *USE authority to journal

Note: Select a time when the system is not busy to save and delete audit journal receivers.

You should regularly detach the current audit journal receiver and attach a new one for two reasons:

  • Analyzing journal entries is easier if each journal receiver contains the entries for a specific, manageable time period.
  • Large journal receivers can affect system performance, in addition to taking valuable space on auxiliary storage.

Having the system manage receivers automatically is the recommended approach. You can specify this by using the Manage receiver parameter when you create the journal.

If you have set up action auditing and object auditing to log many different events, you may need to specify a large threshold value for the journal receiver. If you are managing receivers manually, you may need to change journal receivers daily. If you log only a few events, you may want to change receivers to correspond with the backup schedule for the library containing the journal receiver.

You use the CHGJRN command to detach a receiver and attach a new receiver.

System-Managed Journal Receivers: If you have the system manage the receivers, use the following procedure to save all detached QAUDJRN receivers and to delete them:

  1. Type WRKJRNA QAUDJRN. The display shows you the currently attached receiver. Do not save or delete this receiver.
  2. Use F15 to work with the receiver directory. This shows all receivers that have been associated with the journal and their status.
  3. Use the SAVOBJ command to save each receiver, except the currently attached receiver, which has not already been saved.
  4. Use the DLTJRNRCV command to delete each receiver after it is saved.

Note: An alternative to the above procedure could be done using the journal message queue and monitoring for the CPF7020 message which indicates that the system change journal has completed successfully.