wood burning stoves*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Question about handling localisation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Question about handling localisation" Watch "Question about handling localisation" New topic
Author

Question about handling localisation

Benjamin Ng
Greenhorn

Joined: Jul 12, 2012
Posts: 13
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

Joined: Dec 28, 2007
Posts: 2268
    
    3

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?


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Benjamin Ng
Greenhorn

Joined: Jul 12, 2012
Posts: 13
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

Joined: Dec 28, 2007
Posts: 2268
    
    3

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
Bartender

Joined: Jul 19, 2004
Posts: 5596
    
  15

Benjamin Ng wrote:public void Book()

Methods in Java should be camelCase starting with a lower case letter


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about handling localisation