亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? internationalization.html

?? java good!
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
Java supports the parsing and display of dates through the
<tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/text/DateFormat.html">DateFormat</a></tt> class. There are four formats supported for
dates. Each represents a constant in the class:</p><ul>
<li>SHORT - Completely numeric: 1/2/99</li>
<li>MEDIUM - Abbreviated month: Feb 1, 1999</li>
<li>LONG - Full month name: February 1, 1999</li>
<li>FULL - Completely specified: Saturday, February 1, 1999 AD</li>
</ul><p>The <tt>training-settings-bundle</tt> stored the contents of the "Date" string in the US/Long format. So, when converting from a text string to a <tt>Date</tt> object with the help of the <tt>DateFormat</tt> class, you must specify what format the input text is for the date:</p><pre>
Locale aLocale = getLocale();
ResourceBundle settings = ResourceBundle.getBundle (
    "training-settings-bundle", aLocale);
String dateString = settings.getString("Date");
DateFormat dfInput = DateFormat.getDateInstance (
    DateFormat.LONG, Locale.US);
Date inputDate;
try {
  inputDate = dfInput.parse(dateString));
} catch (ParseException e) {
  inputDate = null;
}
</pre><p>Once you have a <tt>Date</tt>, you need another <tt>DateFormat</tt> to specify how to print out the date. This allows you to format the date for the local display properties  (for things like month/day order and '.' vs. '/' as the separator).</p><pre>
DateFormat dfOutput = DateFormat.getDateInstance (
    DateFormat.SHORT, aLocale);
String dateLabelString;
try {
  dateLabelString = dfOutput.format (
    dfInput.parse(dateString));
} catch (ParseException e) {
  dateLabelString = dateString;
}
</pre><p>For June 3, 2000, this results in the following values:</p><ul>
<li>US - 6/3/00</li>
<li>Italy - 03/06/00</li>
<li>Finland - 03.06.00</li>
</ul><H3><a name="locNumber">Number/Currency Formatting</a></H3>
<p>The <tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/text/NumberFormat.html">NumberFormat</a></tt> class works similarly as
the <tt>DateFormat</tt> class. You can get an instance for a specific <tt>Locale</tt> via <tt>getNumberInstance()</tt> for normal number format, <tt>getCurrencyInstance()</tt> for monetary values, and <tt>getPercentInstance()</tt> for localized percentage format. For this  example, the cost of the class needs to be displayed, so the <tt>getCurrencyInstance()</tt> method is needed to display the output. However, in the resource file, this value was stored as a raw number; so for input the <tt>getNumberInstance()</tt> mehtod needs to be used.</p><pre>
String costString = settings.getString ("Cost");
NumberFormat nfInput  =
    NumberFormat.getNumberInstance (Locale.US);
NumberFormat nfOutput =
    NumberFormat.getCurrencyInstance (aLocale));
String costLabelString;
try {
  Number n = nfInput.parse (costString);
  costLabelString = nfOutput.format (n.longValue());
} catch (ParseException e) {
  costLabelString = costString;
}
</pre><p>For 1200.00, this results in the following values:</p><ul>
<li>US - $1,200.00</li>
<li>Italy - L. 1.200,00</li>
<li>Finland - 1 200,00 mk</li>
</ul><p>Notice that it does include local currency symbols. However, it doesn't do currency conversions. It is your responsibility to place different costs for each locale in the resource bundle.</p><H3><a name="locMessages">Localized Messages</a></H3>
<p>While resource bundles allow you to get localized message information, if an error message -- or any message the user might see, such as dialog boxes -- needs to be ordered differently based upon the locale involved, just using resource bundles is not a sufficient solution. The <tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/text/MessageFormat.html">MessageFormat</a></tt> class provides the means to properly create these types of messages. A resource bundle would contain the format of the message, while the run-time circumstances would fill in the specifics.</p><p>For instance, one part of the United States might like to see error messages of the form "I/O Exception while loading: Foobar.java," 
while another might like "Foobar.java loaded unsuccessfully: I/O Exception." 

Or, the message
<pre>
The disk G contains 3 files. (English)
</pre>
is translated into French as
<pre>
Il y a 3 fichiers sur le disque G. (French)
</pre>
Note that the order of the parameters "G" and "3" is reversed.
</p><p>
To do this, one would first need to create two resource bundles (as above), one for each part of the country. In bundle one, the format for this specific error would be defined as: "{0} while loading: {1}", while the second would have: "{1} loaded unsuccessfully: {0}". The <tt>{0}</tt> represents a position holder to substitute arguments into the message. The position holders start at 0 and increase.</p><p>When it comes time to actually create the message to display, with the arguments filled in, you use the <tt>MessageFormat.format()</tt> method. This takes two arguments, the first being the message to format, the second being an <tt>Object []</tt> of the arguments. The
following demonstrates everything:</p><pre>
import java.text.*;
public class format-it {
  public static void main (String args[]) {
    String format1 = "{0} while loading: {1}";
    String format2 = "{1} loaded unsuccessfully: {0}";
    String exceptionName = "I/O Exception";
    String filename = "Foobar.java";
    Object [] fmtargs = {exceptionName, filename};
    System.out.println (
      MessageFormat.format (format1, fmtargs));
    System.out.println (
      MessageFormat.format (format2, fmtargs));
  }
}
</pre><p>The output of running follows:</p><pre>
Foobar.java while loading: I/O Exception
I/O Exception loaded unsuccessfully: Foobar.java
</pre><p>Besides just plain numbers as arguments for the formatting, you can specify datatypes and formatting information, to automate the use of the other formatting classes, like <tt>DateFormat</tt> and <tt>NumberFormat</tt>. For instance, to specify the second parameter should be output as a long-formatted date string, you would use <tt>{1,date,long}</tt> as the argument. The <tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/text/MessageFormat.html">MessageFormat</a></tt> API documentation provides complete information on all the special formatting options.</p><H2><a name="locAConcl">Starting Application</a></H2>
<p>So, now that the program displays localized text labels and localized date/number formats, you can consider it a <i>global program</i>. It has been localized to adapt to the locale of the user and internationalized by isolating the language dependent pieces. Localizing without internationalizing could result in 3 separate programs, one specific to each area.</p><p>With the help of some resource bundles, the sample program is now complete.</p><center>
<table>
<tr><td>Finland<br><img  src="images/class-fi.gif"/>
</td></tr>
<tr><td>Italy<br><img  src="images/class-it.gif"/>
</td></tr>
</table>
</center><ul>
<li>training-labels-bundle [<a href="src/training-labels-bundle.java">US</a> | 
                          <a href="src/training-labels-bundle-fi.java">FI</a> | 
                          <a href="src/training-labels-bundle-it.java">IT</a>]</li>
<li>training-settings-bundle [<a href="classes/training-settings-bundle.properties">US</a> |
                            <a href="classes/training-settings-bundle-fi.properties">FI</a> |
                            <a href="classes/training-settings-bundle-it.properties">IT</a>]</li>
</ul><p>To run an application with a different locale, you would either programmatically change the locale or configure the <tt>System</tt> properties of <tt>user.language</tt> and <tt>user.region</tt>. For instance, the following starts the <tt>ClassSchedule</tt> program with the Italian locale:</p><pre>
java -Duser.language=it -Duser.region=IT ClassSchedule
</pre><H2><a name="locText">Displaying Unicode Characters</a></H2>
<p>After following Sun's instructions for <a href="internationalization.html#locOnline">adding fonts to the Java runtime</a>, you can now have your programs display non-Western/Latin1 characters. While one would think this would work for <tt>TextField</tt> and <tt>TextArea</tt> components, it really only works when drawing strings or with some AWT components, like <tt>Label</tt> or <tt>Choice</tt>, where user input methods aren't involved. Since Swing components are all drawn from within the Java runtime, this isn't so much of an issue there. The following is a simple demonstration of displaying Japanese characters:</p><center><img  src="images/my-display.gif"/>
</center><pre>
import java.awt.*;
import java.awt.event.*;

public class my-display extends Frame {
  public static class MyCanvas extends Canvas {
    public MyCanvas() {
      setFont (new Font ("Serif", Font.PLAIN, 36));
    }
    public void paint (Graphics g) {
      String s = "\u3041\u3042\u3043\u3044\u3045";
      g.drawString(s, 20, 50);
    }
  }
  public my-display() {
    super("Unicode Tester");
    add(new MyCanvas(), BorderLayout.CENTER);
    Choice c = new Choice();
    c.addItem ("\u3041\u3042\u3043\u3044\u3045");
    c.addItem ("\u3041\u3042\u3043\u3044\u3046");
    add (c, BorderLayout.SOUTH);
  }
  public static void main(String[] args) {
    Frame f = new my-display();
    f.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });
    f.setSize (300, 150);
    f.setVisible(true);
  }
}
</pre><p>There is nothing that prevents you from including non-ASCII characters in resource bundles.</p><H2><a name="locOnline">Online Resources</a></H2>
<p>


<ul>
<li><a href="http://java.sun.com/products/jdk/1.3/docs/guide/intl/index.html">JDK 1.3 Internationalization Information</a></li>
<li><a href="http://java.sun.com/products/jdk/1.3/docs/guide/intl/fontprop.html">Adding Fonts to the Java Runtime</a></li>
<li><a href="http://java.sun.com/products/jilkit/">Java Internationalization and Localization Toolkit</a></li>
<li><a href="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">ISO-639, two letter language codes</a></li>
<li><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">ISO-3166, two letter country codes</a></li>
</ul>


</p><p><font size=-2>[<i>MML: 2.0b27</i>]</font><br>
<font size=-2>[<i>Version: $ /Internationalization2/internationalization.mml#4 $</i>]</font></p>
<!-- END CONTENT -->

</td>
</tr>

<tr><td colspan=2>&nbsp;</td></tr>

<tr><td bgcolor="#336699" colspan=2><img src="images/footer.gif" width=600 height=9 alt="" border="0"></td></tr>

<tr><td colspan=2><font FACE="verdana,arial,helvetica" SIZE="1">Copyright 1996-2000 jGuru.com</font></td></tr>
</table>


</body>
</html>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美美女喷水视频| 97久久精品人人爽人人爽蜜臀| 欧美女孩性生活视频| 伊人婷婷欧美激情| 在线免费亚洲电影| 视频一区在线视频| 日韩亚洲欧美高清| 国产综合色精品一区二区三区| 国产亚洲福利社区一区| av一区二区三区四区| 亚洲一区在线观看免费| 91精品国产品国语在线不卡| 另类小说色综合网站| 国产日韩欧美电影| 99riav一区二区三区| 亚洲va欧美va天堂v国产综合| 欧美疯狂性受xxxxx喷水图片| 国内精品嫩模私拍在线| 国产精品剧情在线亚洲| 欧美喷潮久久久xxxxx| 精品无码三级在线观看视频| 中文字幕在线播放不卡一区| 欧美色视频在线| 韩日av一区二区| ...xxx性欧美| 91精品国产福利| 成人免费视频国产在线观看| 一区二区三区高清不卡| 精品第一国产综合精品aⅴ| 成人一区二区在线观看| 日韩电影在线一区| 国产女主播在线一区二区| 在线观看欧美黄色| 国产成人亚洲精品狼色在线| 五月激情综合婷婷| 国产精品久久看| 欧美一级在线免费| 色噜噜久久综合| 黄色资源网久久资源365| 亚洲一区二区三区四区的| 久久无码av三级| 91蝌蚪porny| 免费观看日韩电影| 久久综合九色综合97婷婷女人| 国产精品成人免费在线| 蜜桃精品视频在线| 天堂影院一区二区| 午夜影院在线观看欧美| 精品国产伦一区二区三区观看方式 | 欧美日韩1区2区| 国产69精品一区二区亚洲孕妇| 天天综合网 天天综合色| 国产精品久久看| 久久精品视频网| 日韩精品一区二区三区中文不卡| 在线亚洲一区二区| 99久久精品情趣| 国产不卡视频在线播放| 美女网站在线免费欧美精品| 亚洲成在线观看| 亚洲综合999| 一区二区三区免费看视频| 国产精品无码永久免费888| 久久色在线观看| 日韩三级在线观看| 91精品国产一区二区三区香蕉| 91网上在线视频| 成人黄色在线网站| 国产成人在线色| 国产精品888| 国产久卡久卡久卡久卡视频精品| 日本欧美在线看| 日本不卡视频在线观看| 五月天久久比比资源色| 亚洲福利一二三区| 亚洲国产精品久久一线不卡| 亚洲成av人片在线| 亚洲线精品一区二区三区八戒| 亚洲综合免费观看高清在线观看| 一区二区三区四区亚洲| 一区二区在线观看免费视频播放| 亚洲人午夜精品天堂一二香蕉| 中文字幕av资源一区| 国产精品久久99| 综合久久一区二区三区| 一级精品视频在线观看宜春院 | 久久99精品久久久久| 奇米一区二区三区av| 免费xxxx性欧美18vr| 国产精品香蕉一区二区三区| 丁香五精品蜜臀久久久久99网站| 不卡电影免费在线播放一区| 99精品久久只有精品| 欧洲亚洲国产日韩| 制服丝袜成人动漫| 国产视频一区二区在线观看| 国产精品色噜噜| 亚洲综合色噜噜狠狠| 偷窥少妇高潮呻吟av久久免费| 九九久久精品视频| 国产精品123区| 色综合亚洲欧洲| 91精品中文字幕一区二区三区| 日韩亚洲欧美成人一区| 欧美国产日韩精品免费观看| 亚洲色图.com| 免费成人结看片| 成人v精品蜜桃久久一区| 色视频成人在线观看免| 日韩欧美在线网站| 国产精品免费看片| 日韩av成人高清| 北条麻妃一区二区三区| 91精品国产色综合久久久蜜香臀| 国产视频在线观看一区二区三区| 一区二区三区高清不卡| 国模无码大尺度一区二区三区| 91一区一区三区| 精品久久久久久久久久久久久久久久久 | 亚洲激情网站免费观看| 日本欧美一区二区在线观看| 成人av在线资源网| 欧美精品tushy高清| 国产目拍亚洲精品99久久精品| 亚洲综合一区在线| 国产成人精品一区二| 91麻豆精品国产91久久久久 | 亚洲精品乱码久久久久久黑人| 天堂成人国产精品一区| 成人av集中营| 日韩欧美亚洲国产另类| 亚洲免费在线观看| 丁香六月久久综合狠狠色| 在线播放日韩导航| 亚洲人成人一区二区在线观看| 精品一区二区三区免费观看| 91九色02白丝porn| 亚洲国产精品成人久久综合一区| 日韩主播视频在线| 91片黄在线观看| 国产校园另类小说区| 裸体健美xxxx欧美裸体表演| 欧美亚洲愉拍一区二区| 国产精品成人在线观看 | 成人免费不卡视频| 亚洲精品在线观看视频| 三级欧美韩日大片在线看| 91在线视频18| 中文字幕不卡一区| 国产suv一区二区三区88区| 91精品啪在线观看国产60岁| 一区二区三区久久| 91首页免费视频| 国产精品高潮呻吟久久| 国产精品99久久久| 久久噜噜亚洲综合| 极品美女销魂一区二区三区免费 | 欧美一区2区视频在线观看| 亚洲电影中文字幕在线观看| 日本韩国一区二区三区| 亚洲天堂成人在线观看| 波多野结衣在线一区| 国产免费成人在线视频| 成人性生交大片免费看中文网站| 精品免费99久久| 国产呦精品一区二区三区网站| 日韩精品一区二区三区视频播放 | 9人人澡人人爽人人精品| 久久精品无码一区二区三区| 久久99精品国产麻豆婷婷| 日韩精品一区国产麻豆| 国产综合久久久久久鬼色| 久久久久久久久久看片| 国产精品自在欧美一区| 国产欧美综合在线| 成人av动漫网站| 亚洲综合色噜噜狠狠| 欧美美女喷水视频| 青青草国产精品97视觉盛宴 | 欧美理论在线播放| 秋霞午夜av一区二区三区| 日韩欧美高清一区| 国产麻豆午夜三级精品| 国产精品乱人伦| 91视视频在线直接观看在线看网页在线看| 亚洲视频每日更新| 欧美精品在欧美一区二区少妇| 免费美女久久99| 国产亚洲欧洲997久久综合| 白白色 亚洲乱淫| 亚洲综合一二三区| 欧美一区二区三区视频免费播放| 麻豆国产精品视频| 国产精品久久久久影院亚瑟| 欧美三区免费完整视频在线观看| 秋霞午夜鲁丝一区二区老狼| 国产色综合一区| 91黄色免费看| 精品中文字幕一区二区| 中文字幕在线免费不卡|