Tweet
|
In C programming, the function 'setlocale()' and other APIs are called in 'main' (see here ). In Java, this is unnecessary. However, if you want to use a specific locale (e.g. a locale specified in a file), you can apply the specified locale to the whole of application with the following methods called in 'main':
public static void main(String[] args) { Locale.setDefault(bundle.getLocale()); // *You need the method below for Swing APIs (JFileChooser .etc). JComponent.setDefaultLocale(bundle.getLocale()); ... }The classes listed below are internationalized. Methods of these classes are affected by the locale.
------------------------------------------------ Internationalized classes ------------------------------------------------ java.io.InputStreamReader java.io.OutputStreamWriter java.lang.Character java.lang.Character.Subset java.lang.Character.UnicodeBlock java.text.AttributedCharacterIterator java.text.AttributedCharacterIterator.Attribute java.text.BreakIterator java.text.CharacterIterator java.text.ChoiceFormat java.text.CollationElementIterator java.text.CollationKey java.text.Collator java.text.DateFormat java.text.DateFormatSymbols java.text.DecimalFormat java.text.DecimalFormatSymbols java.text.FieldPosition java.text.Format java.text.MessageFormat java.text.NumberFormat java.text.ParsePosition java.text.RuleBasedCollator java.text.SimpleDateFormat *1) java.text.StringCharacterIterator java.util.Calendar java.util.GregorianCalendar java.util.ListResourceBundle java.util.Locale java.util.PropertyResourceBundle java.util.ResourceBundle java.util.SimpleTimeZone java.util.TimeZone java.awt.ComponentOrientation java.awt.Font java.awt.GraphicsEnvironment java.awt.font.TextLayout java.awt.font.CaretPolicy java.awt.im.InputContext java.awt.im.InputMethodRequests java.awt.im.InputMethodHighlight java.awt.im.InputSubset java.awt.im.spi.InputMethod java.awt.im.spi.InputMethodContext java.awt.im.spi.InputMethodDescriptor ------------------------------------------------Note that the following internationalized methods are deprecated so you have to use the alternative methods.
------------------------------------------------------------------------------- Deprecated method Alternate method ------------------------------------------------------------------------------- java.util.Date.getDate java.util.Calendar.get java.util.Date.getDay java.util.Calendar.get java.util.Date.getHours java.util.Calendar.get java.util.Date.getMinutes java.util.Calendar.get java.util.Date.getMonth java.util.Calendar.get java.util.Date.getSeconds java.util.Calendar.get java.util.Date.getTimezoneOffset java.util.Calendar.get java.util.Date.getYear java.util.Calendar.get java.util.Date.parse java.text.DateFormat.parse java.util.Date.setDate java.util.Calendar.set java.util.Date.setHours java.util.Calendar.set java.util.Date.setMinutes java.util.Calendar.set java.util.Date.setMonth java.util.Calendar.set java.util.Date.setSeconds java.util.Calendar.set java.util.Date.setYear java.util.Calendar.set java.util.Date.toString java.text.DateFormat.format java.util.Date.toGMTString java.text.DateFormat.format java.util.Date.toLocaleString java.text.DateFormat.format java.util.Date.UTC java.util.Calendar.set java.io.DataInputStream.readLine java.io.BufferdReader.readLine java.lang.Runtime.getLocalizedInputStream java.io.InputStreamReader java.lang.Runtime.getLocalizedOutputStream java.io.OutputStreamWriter java.lang.Character.isSpace java.lang.Character.isWhitespece --------------------------------------------------------------------------------*1)SimpleDateFormat is internationalized, but DateFormat is more recommended.
Go to Internationalization Programming Top