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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? internationalization.html

?? java good!
?? HTML
?? 第 1 頁 / 共 2 頁
字號:
<html>

<head>
<TITLE>jGuru: Internationalization</TITLE>
<style>
<!--
a{text-decoration:none;}
a:hover{color:6699cc; }
body{background-color:white;}
-->
</style>
</head>

<BODY BACKGROUND="images/watermark.gif" BGCOLOR="#FFFFFF" LINK="#006699" VLINK="#006699">

<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr><td bgcolor="#336699" colspan=2 align=right><img src="images/topbar.gif" width=600 height=14 alt="" border="0"></td></tr>
<tr><td colspan=2>&nbsp;</td></tr>
<tr valign=top>

<td valign="top" width="140"><div align="center"><img src="images/logo.gif" width=78 height=90 alt="" border="0"></div>
<font color="#0000FF" size="1" face="verdana,arial,helvetica"><strong><br>

	<a href="contents.html">COURSE NOTES</a><br><img src="images/spacer.gif" width=1 height=4 alt="" border="0"><br><img src="images/spacer.gif" width=1 height=4 alt="" border="0"><br><a href="index.html">MODULE INTRO</a><br><img src="images/spacer.gif" width=1 height=4 alt="" border="0"><br>
<!-- AFTER GUTTER -->

<img src="images/spacer.gif" width=140 height=1 alt="" border="0">
</strong></font>
</td>

<TD valign=top align=left>

<!-- START CONTENT -->

<H1><strong>Internationalization</strong></H1>
<H2><a name="locIntro">What is Localization?</a></H2>
<p><em>Localization</em> is the ability to customize a program to the user's language (e.g., for prompts and
error messages) and display characteristics (e.g., for how to display times and dates).
The different customizations are defined by individual areas or regions, each called
a <tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/util/Locale.html">Locale</a></tt>.</p><p>Before you can localize any programs, you need to isolate the locale dependent pieces. This
isolation process is called <em>internationalization</em>. In the simplest case, this involves the moving of all
<tt>String</tt> constants into something called a
<tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/util/ResourceBundle.html">ResourceBundle</a></tt>. However, resource bundles are not
restricted to just text messages and may include images, sounds, and numeric information. And this
isn't the only step involved.</p><H2><a name="locLocale">The Locale Object</a></H2>
<p>A <tt>Locale</tt> is specified by adding a trailing string to an identifier that specifies a <tt>ResourceBundle</tt>. The first three letters are an underscore ('_') and a two character language code (lowercase). The next three are an underscore and
a two character country code (uppercase). This is because not everyone speaking the same language speak the same dialect. For instance, Quebec and France have different variations on the French language. <tt>_fr_FR</tt> is France French, while <tt>_fr_CA</tt> is French Canadian.</p><p>A locale, then, defines a specific local area, without specifying any other details about that area's needs.  The class <tt>Locale</tt> resides in the <tt>java.util</tt> package. 
Several classes provide methods that return instances of <tt>Locale</tt>.</p><p>
To construct a locale manually, use code resembling
</p><pre>
Locale l = 
  new Locale(String lang, String country, 
             String variant);
</pre><p>or</p><pre>
Locale l = 
  new Locale(String lang, String country);
</pre><p>Every runtime has a default locale, which you can acquire using</p><pre>
Locale l = Locale.getDefault();
</pre><p>You can also set the default locale by setting system properties; however, this is not recommended, since the user may have set his own default <tt>Locale</tt>, and this would override those settings.</p><pre>
// dangerous
Properties p = System.getProperties();
p.put("user.language", "fr");
p.put("user.region", "CA");
System.setProperties(p);
</pre><p>Some objects may set their own locale, which would override the default locale. Those objects (including all AWT Components) implement a <tt>getLocale()</tt> method.
If no locale is set, it returns the default locale.</p><p>To retrieve a list of all the available locales, use
<tt>Locale list[] = DateFormat.getAvailableLocales();</tt>. 
The <tt>locale.toString()</tt> method returns the concatenated locale value, e.g. 
<tt>"_fr_FR"</tt> (French / France),
<tt>"_fr_CA"</tt> (French / Canada), or
<tt>"_en_US"</tt> (English / United States).
To retrieve the individual locale "components" as strings, use
<tt>locale.getLanguage()</tt>,
<tt>locale.getCountry()</tt>, and
<tt>locale.getVariant()</tt>.
</p><H2><a name="locDemo">Why You Need It</a></H2>
<p>
<center><img  src="images/class.gif"/>
</center>
</p><p>Imagine taking this program and trying to run it in Italy and Finland. While it will run, there are a few internationalization issues:</p><ul>
<li>All text labels are in English</li>
<li>The Date display format is specific to the United States</li>
<li>The Money display format is specific to US $</li>
<li>The map image and city listed are in the United States</li>
</ul><p>You'll now see how you can internationalize the application.</p><H2><a name="locResBund">Resource Bundles</a></H2>
<p>In order to localize labels, you need to pull them all out and do lookups at runtime.
The means to do this is through the <tt>ResourceBundle</tt> class. Resource bundles
provide a simple key-value lookup and may be provided via <tt>.class</tt> or <tt>.properties</tt> files.
(Other means can also be provided, however you would have to do all the work yourself.)</p><p>To provide a lookup list via a class, you subclass 
<tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/util/ListResourceBundle.html">ListResourceBundle</a></tt> and override the
<tt>getContents</tt> method to return an <tt>Object[][]</tt>. For each pair of elements in the array, the first would be the lookup key and the second the value for the key for the given <tt>Locale</tt>.</p><pre>
import java.util.ListResourceBundle;
public class training-labels-bundle
    extends ListResourceBundle {
  static final Object[][] contents = {
    { "Date",     "Date: " },
    { "Cost",     "Cost: " }, 
    { "Location", "Location: " },
    { "Title",    "Training" }
  };
  protected Object[][] getContents() {
    return contents;
  }
}
</pre><p>In the <tt>training-labels-bundle</tt> defined above, four lookup labels define four properties:</p><ul>
<li>Date</li>
<li>Cost</li>
<li>Location</li>
<li>Title</li>
</ul><p>You would then use this bundle to lookup resources in a two step process: load the resource list and search it. To load the list, use <tt>ResourceBundle.getBundle()</tt>. This will load the bundle for the appropriate <tt>Locale</tt>. Since there is only one so far, and it is the default, the <tt>training-labels-bundle</tt> one is what is loaded.</p><pre>
Locale locale = getLocale();
ResourceBundle labels = ResourceBundle.getBundle (
    "training-labels-bundle", locale);
</pre><p>Once you have a bundle, you lookup entries via its <tt>getString()</tt> method:</p><pre>
p.add (new Label (labels.getString("Date")));
</pre><p>The program for the figure shown above can now include the following:</p><pre>
ResourceBundle labels = ResourceBundle.getBundle (
    "training-labels-bundle", locale);
p.add (new Label (labels.getString("Date")));
p.add (new Label (labels.getString ("Cost")));
p.add (new Label (labels.getString ("Location")));
add (new Label (labels.getString ("Title"),
    Label.CENTER), BorderLayout.NORTH);
}
</pre><p>Then, if you want the program to support Italy and Finland locales to display localized labels, you would have to create two new classes: <tt>training-labels-bundle-it</tt> and <tt>training-labels-bundle-fi</tt>. In these classes, only those entries that were different
in the new locale would need to be specified in the bundle. Now that three bundles are defined, based on the current locale setting, the <tt>getBundle()</tt> method would fetch and load the appropriate class.</p><p>For Finland, the appropriate bundle would be:</p><pre>
public class training-labels-bundle-fi 
          extends ListResourceBundle {
  static final Object[][] contents = {
    { "Date",     "P&auml;iv&auml;m&auml;&auml;r&auml;: " },
    { "Cost",     "Hinta: " }, 
    { "Location", "Sijainti: " },
    { "Title",    "Koulutus" }
  };
  protected Object[][] getContents() {
    return contents;
  }
}
</pre><p>For Italy, the appropriate bundle would be:</p><pre>
public class training-labels-bundle-it extends ListResourceBundle {
  static final Object[][] contents = {
    { "Date",     "Data: " },
    { "Cost",     "Costo: " }, 
    { "Location", "Posto: " }
  };
  // The Training title remains the same (or addestramento)
  protected Object[][] getContents() {
    return contents;
  }
}
</pre><H3><a name="locPropRes">Property Resource Bundles</a></H3>
<p>In addition to providing resource bundles as <tt>ListResourceBundle</tt> classes, you can provide <tt><a href="http://java.sun.com/products/jdk/1.2/docs/api/java/util/PropertyResourceBundle.html">PropertyResourceBundle</a></tt>s. These are property files where each resource is specified on its own line as text, as in <tt>Date=June 3, 2000</tt>. Property resource bundle files are named <tt>Bundlename</tt><i>_Localization</i><tt>.properties</tt>.</p><p>The previously described program requires three properties for the actual date, cost, and location map. You can create another bundle in filename <tt>training-settings-bundle.properties</tt> for this information. Since this information is likely to change more frequently, it makes sense to be editable by a human, without requiring recompilation.</p><pre>
Date=June 3, 2000
Cost=1200.00
Map=SMarea.gif
</pre><p>For Finland, the appropriate bundle file would be named <tt>training-settings-bundle-fi.properties</tt> and may include:</p><pre>
Cost=6240
Map=ilmakuva.gif
</pre><p>For Italy, the appropriate bundle file would be named <tt>training-settings-bundle-it.properties</tt> and may include:</p><pre>
Cost=2168400.00
Map=Milan.gif
</pre><p>This assumes the date for all three classes would be the same at the different locations.</p><p>Access to <tt>PropertyResourceBundle</tt> members is identical to <tt>ListResourceBundle</tt>:</p><pre>
ResourceBundle settings = ResourceBundle.getBundle(
    "training-settings-bundle", locale);
String date = settings.getString("Date");
String cost = settings.getString("Cost");
String filename = settings.getString("Map");
</pre><H2><a name="locFormats">Locale-Specific Formats</a></H2>
<p>Once you've pulled all your string constants into resource bundles, its not time to figure out how to display that information. For instance, dates, numbers, and messages may be displayed differently based upon where one is located.</p><H3><a name="locDate">Date Formatting</a></H3>
<p>Display formats of dates are not universal. Is "1/2/99" January 2nd or February 1st? It depends.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区视频在线| 蜜臀va亚洲va欧美va天堂 | 麻豆精品久久精品色综合| 婷婷综合另类小说色区| 免费久久99精品国产| 国产成人aaa| 在线看日韩精品电影| 7777精品伊人久久久大香线蕉| 欧美变态凌虐bdsm| 国产日韩精品一区二区浪潮av| 中文字幕av一区二区三区高| 亚洲一区视频在线| 国产成人免费在线视频| 国产欧美精品一区二区色综合朱莉| 欧美视频在线播放| 欧美日韩精品一区二区天天拍小说 | 九九视频精品免费| 福利一区二区在线观看| 欧美久久婷婷综合色| 一区免费观看视频| 国产99久久久精品| 欧美日本一区二区三区| 国产欧美一区二区三区在线看蜜臀| 亚洲日本在线天堂| 国产激情视频一区二区在线观看 | 国产99一区视频免费| 精品国产一区二区三区忘忧草| 亚洲精品美腿丝袜| 91视视频在线观看入口直接观看www | 成人性生交大片免费| 欧美一卡二卡三卡| 午夜视频在线观看一区二区| 成人精品高清在线| 一色桃子久久精品亚洲| 国产成人夜色高潮福利影视| 欧美变态口味重另类| 日韩影视精彩在线| 欧美日本一区二区三区| 午夜欧美一区二区三区在线播放| 91成人在线免费观看| 丝袜美腿亚洲色图| 久久久久88色偷偷免费| 99精品欧美一区| 亚洲成av人片在线观看无码| 国产色产综合产在线视频| 91色在线porny| 极品少妇xxxx精品少妇| 欧美大度的电影原声| 久久99精品国产麻豆婷婷| www国产精品av| a亚洲天堂av| 国产乱码精品一区二区三区忘忧草 | xvideos.蜜桃一区二区| 99在线精品一区二区三区| 亚洲chinese男男1069| 久久精品视频免费| 欧美区在线观看| av不卡一区二区三区| 午夜不卡av在线| 亚洲欧洲精品一区二区精品久久久 | 欧美日韩一区二区三区四区| 国产真实乱子伦精品视频| 亚洲激情av在线| 久久久久久久久久久99999| 日本乱人伦一区| 99re亚洲国产精品| 国内成+人亚洲+欧美+综合在线| 亚洲麻豆国产自偷在线| 国产欧美一区二区三区沐欲| 欧美另类z0zxhd电影| 色婷婷综合久久久| 国产.欧美.日韩| 国产综合久久久久影院| 毛片av一区二区| 激情文学综合丁香| 婷婷中文字幕一区三区| 亚洲成人tv网| 午夜av电影一区| 免费成人在线观看| 美女视频黄 久久| 蜜乳av一区二区| 国产一区二区三区免费看| 国产一区在线观看麻豆| 国产精品系列在线播放| 岛国一区二区在线观看| 一本久久a久久免费精品不卡| 99久久精品免费看国产| 99麻豆久久久国产精品免费优播| 99re8在线精品视频免费播放| 91免费在线视频观看| 欧美午夜在线一二页| 日韩视频免费观看高清完整版| 日韩精品一区二区在线观看| 久久久美女毛片| 亚洲一区精品在线| 精品一区二区三区在线播放视频| 国产经典欧美精品| 在线精品视频小说1| 欧美一二三区在线观看| 中文字幕国产一区二区| 亚洲h在线观看| 成人精品视频一区二区三区| 欧美亚洲日本一区| 一区二区三区在线视频免费 | heyzo一本久久综合| 欧美一级在线视频| 亚洲欧美综合色| 国产麻豆精品视频| 国产午夜精品一区二区| 一区二区在线观看免费视频播放| 人人精品人人爱| 在线观看精品一区| 国产精品久久久久aaaa| 国产一区二区在线看| 正在播放一区二区| 午夜亚洲福利老司机| 色视频成人在线观看免| 国产精品丝袜黑色高跟| 99久久婷婷国产综合精品电影| 久久久九九九九| 国产老妇另类xxxxx| 精品久久久久久久久久久久久久久久久| 亚洲欧美国产高清| 91免费版在线看| 亚洲永久免费视频| 欧美日韩不卡视频| 日韩中文字幕一区二区三区| 色婷婷亚洲精品| 日韩国产欧美在线观看| 欧美片网站yy| 日本中文字幕不卡| 26uuu精品一区二区在线观看| 精品一区二区免费看| 久久久精品日韩欧美| 成人午夜精品一区二区三区| 中文字幕在线不卡| 色爱区综合激月婷婷| 日韩电影网1区2区| 精品电影一区二区| jlzzjlzz亚洲女人18| 亚洲精品乱码久久久久久黑人 | 国产精品电影院| 欧美巨大另类极品videosbest | 亚洲制服丝袜一区| 国产视频一区二区在线观看| 不卡免费追剧大全电视剧网站| 亚洲精品成人悠悠色影视| 欧美一区二区三区色| 成人av在线网站| 麻豆精品国产91久久久久久| 中文字幕一区三区| 久久久亚洲综合| 日韩三级中文字幕| 欧美午夜影院一区| a在线播放不卡| 国产精品影视天天线| 蜜臀av一区二区三区| 亚洲人成伊人成综合网小说| 精品成人一区二区| 91精品国产丝袜白色高跟鞋| 在线观看av一区| 99国内精品久久| 成人午夜短视频| 国产成人aaa| 国产激情91久久精品导航| 久久99国产精品免费网站| 日韩成人精品视频| 亚洲18女电影在线观看| 亚洲一级二级三级在线免费观看| 亚洲伦在线观看| 亚洲乱码国产乱码精品精可以看| **性色生活片久久毛片| 国产精品麻豆一区二区| 亚洲欧洲国产专区| 亚洲欧美日韩一区二区| 国产精品伦理在线| 亚洲制服丝袜一区| 日韩 欧美一区二区三区| 精品中文字幕一区二区| 狠狠色丁香久久婷婷综合丁香| 国产成人福利片| 一本高清dvd不卡在线观看| 欧美偷拍一区二区| 精品国产乱码久久久久久闺蜜| 中文在线资源观看网站视频免费不卡| 欧美国产成人在线| 亚洲成av人片在线观看| 国产精品一区免费在线观看| 99久久综合狠狠综合久久| 欧美日韩免费一区二区三区视频 | 国产在线精品免费av| 欧美在线你懂的| 中文字幕国产一区二区| 亚洲国产日韩一级| 成人一道本在线| 2022国产精品视频| 日韩中文字幕不卡| 91伊人久久大香线蕉| 精品国产一区二区三区忘忧草| 亚洲午夜一区二区|