⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msgtool.html

📁 是一个加快Java应用程序国际化和本地化开发的工具集。它将大大减少国际化和本地化开发的所消耗的时间和资源。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"><html><head>   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">   <meta name="Author" content="Scarlett Hao">   <meta name="GENERATOR" content="Mozilla/4.5 [zh] (X11; I; SunOS 5.7 sun4u) [Netscape]">   <title> Message Tool</title></head><body bgcolor="#FFFFFF"><center><pre CLASS="ChapTitle"><img SRC="image/titleduket.gif" height=116 width=661><img SRC="image/coffee.gif" height=88 width=57></pre></center><center><b><font size=+2>Message Tool</font></b><p><img SRC="image/rainbow.gif" height=1 width=100%></center><p><b><font size=-1><a href="userguide.html">[contents]</a></font></b><p><b><a href="#Introducing Message Tool">Introducing Message Tool</a></b><br><b><a href="#Using the Message Tool">Using the Message Tool</a></b><ul><b><i><a href="#Getting started with the Message Tool">Getting Startedwith the Message Tool</a></i></b><br><b><i><a href="#Components of Message Tool">Components of Message Tool</a></i></b><br><b><i><a href="#Selecting An Active Item">Selecting An Active Item</a></i></b><br><b><i><a href="#Looking Up Item information">Looking Up Item information</a></i></b><br><b><i><a href="#Defining Bundle variables">Defining Bundle variables</a></i></b><br><b><i><a href="#Defining User-defined resource bundle">Defining User-definedresource bundle</a></i></b><br><b><i><a href="#Operating on Messages">Operating on Messages</a></i></b><br><b><i><a href="#Exporting Resources">Exporting Resources</a></i></b><br><b><i><a href="#Translating Resources">Translating Resources</a></i></b><br><b><i><a href="#Viewing verify report">Viewing Verify Report</a></i></b><br><b><i><a href="#Setting Verify policy">Setting Verify Policies</a></i></b><br><b><i><a href="#Changing  Options">Changing&nbsp; Options</a></i></b><br><b><i><a href="#Internationalize a Java source file">Internationalizea Java source file</a></i></b></ul><b><a href="#Message Tool command line">Message Tool Command-line</a></b><p><a NAME="Introducing Message Tool"></a><b>Introducing Message Tool</b><p>Message Tool can be used to automatically or interactively find andconvert non-internationalized strings in java source files, its main functionsare as follows:<ul><li>Find out all messages(strings) used in java source files.</li><li>Classify the checked out messages as:</li><ul><li>Converted(Finished)</li><li>Need to be converted(Error)</li><li>Need not to be converted(Frozen)</li></ul><li>Define resource objects which can be instances of user-defined resourcebundle or ListResourceBundle, PropertyResourceBundle, ArrayResourceBundle.</li><li>Convert the messages.</li><br>For example, if Message Tool finds the Java source code:<br>Menu fileMenu=new Menu("File"), where "File" is non-internationalizedmessage,<br>it can convert the message to the form:<br>Menu fileMenu=new Menu(aBundle.getString("File"));<br>where aBundle is an object of MyResource class, and MyResource is aclass extends ListResourceBundle class. The object is defined in the javasource file like:<br>ResourceBundle aBundle= ResourceBundle.getBundle("MyResource", Locale.getDefault());<li>Export all generated resource files.</li><li>Includes all functions <b>I18n Verifier</b> can offer.</li></ul><a NAME="Using the Message Tool"></a><b>Using the Message Tool</b><p><a NAME="Getting started with the Message Tool"></a><b><i>Getting Startedwith the Message Tool</i></b><p>You can run<b> Message tool</b> by typing "msgtool" in command line,Or select to run <b>Message Tool</b>(figure1) from I18n/L10n Toolkit 2.0.Then the <b>Message Tool</b> window will pop-up(figure2).<p><img SRC="image/msg_selmsgt.gif" height=404 width=418><h6>Figure1: Select Message Tool</h6><h6><img SRC="image/messagetool.gif" height=617 width=744></h6><h6>Figure2: Message Tool main window</h6><a NAME="Components of Message Tool"></a><b><i>Components of Message Tool</i></b><ul><li>The <b>Current bundle object <i>comboBox</i></b> contains all the namesof the defined bundle variable, among which the selected one will be usedto convert current selected message item.</li><li>The <b>Messages list</b> displays all the messages checked out of the file.Double click on any item of the list, the corresponding message in theright <b>Source Editor</b> window will be selected. Click the right mousebutton, a pop up menu will show for choosing the operation on the selectedmessages.</li><li>The <b>Verify table</b> displays all verified items. The detail introductionof the displayed method of suggestion window is described in Chapter<b><a href="/home/shao/export/TOOLKIT/htmlsrc/verifier.html">I18n Verifier</a></b>.</li><li>The <b>Source Editor</b> window displays the contents of the opened file,you can edit it by hand or use convert functions to convert its stringsto internationalized strings. Resource bundle variables must be firstlydefined before you can convert a message.</li><ul><li><b>Unrefreshed status</b>: after the editor is modified by hand, the toolwill come into <b>unrefreshed status</b> when no messages can be selectedfor automatically processing by message tool.</li><li><b>Refreshed status</b>: originally open a file or run <b>refresh</b> from<b>unrefreshedstatus</b>, the tool will come into <b>refreshed status</b>.</li></ul><li>The<b> Define</b> button is used to define bundle variables. Press <b>Define</b>,the <b>bundle variables definition</b> dialog will pop up(figure3).</li></ul><a NAME="Selecting An Active Item"></a><b><i>Selecting An Active Item</i></b><p>To specify the item for operating on:<ol><li>Double clicked the item to be operated from the editor.</li><li>Double clicked the string item in the string list.</li><li>Select the item from the verifier table.</li></ol>After select an active item, the item info will be specified in the <a href="verifier.html#The information table about all verifier items">verifytable</a>.<p><a NAME="Looking Up Item information"></a><b><i>Looking Up Item information</i></b><p>You can get all information of the items you concern from the <a href="verifier.html#The information table about all verifier items">verifytable</a>. You can also set which kinds of item information will be shownby Changing the parameters in <b>Edit->options</b>.<p><a NAME="Defining Bundle variables"></a><b><i>Defining Bundle variables</i></b><p>You should define the resource bundle variables before converting messages.Do as follows:<ul><li>Click the <b>Define</b> button on the toolbar.</li><li>Click <b>Resources -> Resource Define</b>.</li></ul>&nbsp;&nbsp;&nbsp; Then the <b>Define Bundle variables</b> dialog willpop-up(figure3).<ul>&nbsp;<br><img SRC="image/bundle_var_def.gif" height=426 width=337><h6>Figure3: Bundle variables definition dialog</h6><li>The tabbedpane titles(VerifierSample1 and VerifierSample) show all namesof the classes defined in the java source file, every tab shows all bundlevariables defined in the specified class.</li><li>The list under the <b>Defined Bundle Variables</b> label holds all bundlevariable names in the class, you can select a bundle variable item to showits detail informations.</li><li>The <b>Bundle name </b>field is used to input the name of the resourceto store messages.</li><li>Check the <b>Instance of User-Defined Resource Bundle</b> checkbox to indicatethat the variable's class is a user-defined bundle.</li><li>Press <b>Add</b> button, a new bundle variable will be constructed accordingto the information you input.</li><li>Press <b>Update</b> button, the information shown in GUI will be set tothe selected bundle variable.</li><li>Press <b>Remove</b> button, the selected bundle variable will be removed.</li><li>Press <b>OK</b> to confirm the input or press <b>Cancel</b> to give upthe input.</li></ul><a NAME="Defining User-defined resource bundle"></a><b><i>Defining User-definedresource bundle</i></b><p>Message Tool supports user-defined resource bundle. It means that messagesin the source file can be extracted from a user-defined resource bundleand converted automatically. But in this version of Message Tool, thereis a constraint that the user-defined resource bundle, which is able tobe recognized and processed in Message Tool, should implement the interface<a href=../api/com/sun/tdc/util/UserDefinedResourceBundle.html><tt>com.sun.tdc.util.UserDefinedResourceBundle</tt></a>and provide a method<tt>public static UserDefinedResourceBundle getBundle() </tt>in the implementation class.<br>In the interface <a href=../api/com/sun/tdc/util/UserDefinedResourceBundle.html><tt>com.sun.tdc.util.UserDefinedResourceBundle</tt></a>, Thereare four type of extracting message methods. The following is the&nbsp;summary of the methods:<table BORDER CELLSPACING=0 CELLPADDING=3 WIDTH="100%" ><tr BGCOLOR="#CCCCFF" ID="TableHeadingColor"><td COLSPAN="2"><b><font size=+2>Method Summary</font></b></td></tr><tr BGCOLOR="#FFFFFF" ID="TableRowColor"><td ALIGN=RIGHT VALIGN=TOP WIDTH="1%"><tt><font size=-1>&nbsp;java.lang.String</font></tt></td><td><tt><b>getString</b>(java.lang.String key)</tt><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get messagestring from resource bundle by a specified key.</td></tr><tr BGCOLOR="#FFFFFF" ID="TableRowColor"><td ALIGN=RIGHT VALIGN=TOP WIDTH="1%"><tt><font size=-1>&nbsp;java.lang.String</font></tt></td><td><tt><b>getString</b>(java.lang.String key, java.util.Locale locale)</tt><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get messagestring from resource bundle by a specified key and specified locale.</td></tr><tr BGCOLOR="#FFFFFF" ID="TableRowColor"><td ALIGN=RIGHT VALIGN=TOP WIDTH="1%"><tt><font size=-1>&nbsp;java.lang.String</font></tt></td><td><tt><b>getString</b>(java.lang.String key, java.lang.String defaultValue)</tt><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get messagestring from resource bundle by a specified key.</td></tr><tr BGCOLOR="#FFFFFF" ID="TableRowColor"><td ALIGN=RIGHT VALIGN=TOP WIDTH="1%"><tt><font size=-1>&nbsp;java.lang.String</font></tt></td><td><tt><b>getString</b>(java.lang.String key, java.lang.String defaultValue,java.util.Locale locale)</tt><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Get messagestring from resource bundle by a specified key.</td></tr></table>The way of defining a user-defined resource bundle is same as <b><i><a href="#Defining Bundle variables">DefiningBundle variables </a></i></b>mostly. But <b>Instance of User-Defined ResourceBundle</b> checkbox should be checked. And all information in the box(seefigure 3) should be specified. The <b>Class name </b>is the full-quality

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -