Java
Java was the main language taught while I was studying at TCD. I've been programming in Java since 2007. Working on development of eclipse plugins. Recently started working with Spring and Hibernate.
A Little i18n
Had some internationalization training recently. Externalize strings is the big take away, use message files as below. i18n is the practice of making applications adaptable to different locales and cultures. l10n is the process of localizing the application for a specific locale.
Messages_fr_FR.properties:
yesMessage = oui
noMessage = non
Messages_en_GB:
yesMessage = yes
noMessage = no
1 import java.util.Locale; 2 import java.util.ResourceBundle; 3 4 public class I18N { 5 6 String yesMessage; 7 String noMessage; 8 9 static String language; 10 static String country; 11 12 static public void main(String[] args) { 13 //expect "en" "GB", "fr" "FR" etc 14 if (args.length != 2) { 15 System.out.println("No locale args given"); 16 System.exit(1); 17 } 18 19 language = new String(args[0]); 20 country = new String(args[1]); 21 22 Locale locale = new Locale(language, country); 23 ResourceBundle captions = ResourceBundle.getBundle("Messages", locale); 24 25 String yesMessage = captions.getString("yesMessage"); 26 String noMessage = captions.getString("noMessage"); 27 28 System.out.println(language + "_" + country); 29 System.out.println("yesMessage = " + yesMessage); 30 System.out.println("noMessage = " + noMessage); 31 } 32 }





