Firebug:
To download the firbug development tool:
http://getfirebug.com/
Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.
Features:
Inspect HTML and modify style and layout in real-time: After installing or adding plug-in of firebug, see at the bottom of, an icon image (a worm image), click here,
Use the most advanced JavaScript debugger available for any browser
Accurately analyze network usage and performance
Some very helpful shortcuts and commands when working with firebug. Thanks to Duvet-Dayez for creating this cheat sheet.
Firebug cheat sheet
Deepak
Saturday, September 25, 2010
Thursday, September 23, 2010
Internationalization in GWT
In my last assignment, i got good assignments on GWT like internationalization, history implementation and maintenance of log.
They are easy, but while you are doing these thing first time specially in GWT,then it is not a simple nut.
So i would like to discuss internationalization here.
First create GWT project. (Here i am creating project name: UsePropertyScreen)
Create 2 interface and 2 properties file with same name like PropertConstant.java and PropertyMessage.java and property files with PropertyConstant.properties and PropertyMessage.properties.
Code for PropertConstant.java
package deepak;
import com.google.gwt.i18n.client.Constants;
public interface PropertConstant extends Constants {
String hello();
//Add more key values here
}
Code for PropertyMessage.java
package deepak;
import com.google.gwt.i18n.client.Messages;
public interface PropertyMessage extends Messages {
String alertMessage();
String alertParameter(String arg);
}
Now Make entries in .property file also. Please provide same key as you gave in java file. i.e function name in java =key value in properties
PropertyConstant.properties
hello=Hello Deepak
PropertyMessage.java
alertMessage=Hello deepak!, welcome
alertParameter= Hello {0}
So if you want to pass more parameter, define function with parameter and in property file use {0} for first parameter and {1} for second parameter etc
Now make samall change in UsePropertyScreen.gwt.xml.file
<inherits name="com.google.gwt.i18n.I18N">
<extend-property name="locale" values="PropertyMessage">
And now use these key value inside client side file. It can't be used server side files.
Screen.java
package deepak;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.gwtext.client.widgets.MessageBox;
public class UsePropertyScreen implements {
private final PropertyMessage message=GWT.create(PropertMessage.class);
private final PropertyConstant constant=GWT.create(PropertConstant.class);
public UsePropertyScreen(){
MessageBox.alert(constant.hello());
MessageBOx.alert(message.alertMessage());
MessageBOx.alert(message.alertParameter("Deepak Pandey"));
RootPanel.get().add(new Label(constant.hello()));
}
}
Now run this application.
YOu will get 3 alert,
First with : "Hello Deepak"
Second with : "Hello Deepak!, welcome"
Third with : Hello Deepak Pandey
By default it will take above files. But if you want to change propert file according to your language. Create property file in following manner:
PropertyMessage_hi.properties
and select Hindi language or use hi in url address. So you are able to identify.
and change in UsePropertyScreen.gwt.xml,
<extend-property name="locale" values="hi">
cheers!
They are easy, but while you are doing these thing first time specially in GWT,then it is not a simple nut.
So i would like to discuss internationalization here.
First create GWT project. (Here i am creating project name: UsePropertyScreen)
Create 2 interface and 2 properties file with same name like PropertConstant.java and PropertyMessage.java and property files with PropertyConstant.properties and PropertyMessage.properties.
Code for PropertConstant.java
package deepak;
import com.google.gwt.i18n.client.Constants;
public interface PropertConstant extends Constants {
String hello();
//Add more key values here
}
Code for PropertyMessage.java
package deepak;
import com.google.gwt.i18n.client.Messages;
public interface PropertyMessage extends Messages {
String alertMessage();
String alertParameter(String arg);
}
Now Make entries in .property file also. Please provide same key as you gave in java file. i.e function name in java =key value in properties
PropertyConstant.properties
hello=Hello Deepak
PropertyMessage.java
alertMessage=Hello deepak!, welcome
alertParameter= Hello {0}
So if you want to pass more parameter, define function with parameter and in property file use {0} for first parameter and {1} for second parameter etc
Now make samall change in UsePropertyScreen.gwt.xml.file
<inherits name="com.google.gwt.i18n.I18N">
<extend-property name="locale" values="PropertyMessage">
And now use these key value inside client side file. It can't be used server side files.
Screen.java
package deepak;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.gwtext.client.widgets.MessageBox;
public class UsePropertyScreen implements {
private final PropertyMessage message=GWT.create(PropertMessage.class);
private final PropertyConstant constant=GWT.create(PropertConstant.class);
public UsePropertyScreen(){
MessageBox.alert(constant.hello());
MessageBOx.alert(message.alertMessage());
MessageBOx.alert(message.alertParameter("Deepak Pandey"));
RootPanel.get().add(new Label(constant.hello()));
}
}
Now run this application.
YOu will get 3 alert,
First with : "Hello Deepak"
Second with : "Hello Deepak!, welcome"
Third with : Hello Deepak Pandey
By default it will take above files. But if you want to change propert file according to your language. Create property file in following manner:
PropertyMessage_hi.properties
and select Hindi language or use hi in url address. So you are able to identify.
and change in UsePropertyScreen.gwt.xml,
<extend-property name="locale" values="hi">
cheers!
Subscribe to:
Posts (Atom)