Java I18n

xiaoxiao2021-03-06  18

- What to be internationalized Messages Labels on GUI Online help Sounds Graphics Icons Dates Times Numbers Currencies Measurements Phone Numbers Honorifics and personal titles Postal address Page layouts -? Language Code & Country Code http://ftp.ics.uci.edu/pub/ ietf / http / related / iso639.txt (Language Code) http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html (Country Code) - Find out which Locale definitions are supported by the DateFormat class locale list [] = DateFormat.getAvailableLocales (); - Example Code String languageCode = "en"; String countryCode = "US"; locale currentLocale = new locale (languageCode, countryCode); ResourceBundle labels = ResourceBundle.getBundle ( "LabelsBundle", Currentlocale; system.out.println (labels.getstring ("ok");

- The order of ResourceBundle looking up properties file If defaule locale is en_US Locale currentLocale = new Locale ( "fr", "CA", "UNIX"); ResourceBundle introLabels = ResourcBundle.getBundle ( "ButtonLabel", currentLocale); ButtonLable_fr_CA_UNIX ButtonLable_fr_CA ButtonLable_fr ButtonLable_en_US ButtonLable_en ButtonLable - How to format Numbers and Currencies Double amount = new Double (345987.246); numberFormatter = NumberFormat.getNumberInstance (currentLocale); amountOut = numberFormatter.format (amount); ============= =============================================== Double currency = New Double (9876543.21); currencyformatter = Numberformat.getCurrencyInstance (curRenTlocale); currencyout = currencyformatter.format (currency); ========================= =========================================== percentformatter = NumberFormat.getPercentInstance (currentlocale); percentout = percentformatter.format (Percent) ); - how to format Dates and Times Dateformatter = DateFormat.getdateins TANCE (DateFormat.default, currentlocale); today = new date (); Dateout = DateFormatter.Format (Today);

转载请注明原文地址:https://www.9cbs.com/read-41272.html

New Post(0)