File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about handling localisation

 
Benjamin Ng
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have decided to use resourcebundle to retrieve text from properties file and display on GUI. However there is some similar text that will be used throughout a class so for such scenario what is the best convention to handle? option A or B?

// option A
public static final String TITLE = GuiResources.getString("title");

public void Book()
{
displayDialog(TITLE, "please enter");
//more coding for booking
displayDialog(TITLE, "success booking");
}

//option B

public void Book()
{
displayDialog(GuiResources.getString("title"), "please enter");
//more coding for booking
displayDialog(GuiResources.getString("title"), "success booking");
}
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say option A is cleaner.

But... is this question of yours related to the OCMJD certification? Are you going to use something like this in your solution?
 
Benjamin Ng
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roberto Perillo wrote:I'd say option A is cleaner.

But... is this question of yours related to the OCMJD certification? Are you going to use something like this in your solution?


Hi Roberto,

Yes is related to OCMJD certification. i wanted to use something like option A in my solution for displaying text in GUI but not sure whether is good convention.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Benjamin Ng wrote:Yes is related to OCMJD certification.


Alright, champ! Just checking. I just wanted to make sure threads stay where they belong.
 
Roel De Nijs
Sheriff
Posts: 9105
75
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Benjamin Ng wrote:public void Book()

Methods in Java should be camelCase starting with a lower case letter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic