XUL简介
Why use XUL?为何使用XUL?
翻译者:翟翔 legendren2008@yahoo.com.cn 最后翻译更新:2005年3月14日星期一
The XML User Inte易做图ce Language (XUL) is a markup language for creating rich dynamic user inte易做图ces. It is a part of the Mozilla browser and related applications and is available as part of Gecko. It is designed to be portable and is available on all versions of Windows, Macintosh as well as Linux and other Unix flavours. With XUL and other Gecko components, you can create sophisticated applications without special tools.
XML用户界面语言(XUL)是用来创建丰富动态用户界面的语言。它是Mozilla浏览器的一部分,也是和Mozilla相关联的应用程序,并且可以作为Gecko的一部分。它设计成为适应所有版本的Windows,Macintosh,还有Linux和其他的Unix操作系统。拥有了XUL和其他的Gecko组件,你就可以创建精密复杂的应用程序而不用使用特别的工具。
XUL was designed for creating the user inte易做图ce of the Mozilla application including the web browser, mail client and page editor. XUL may be used to create these types of applications. However, it may also be used any place you would use currently use a web application, for instance, when you need to be able to retrieve resources from the network and require a richer user inte易做图ce. Like HTML, in XUL you can create an inte易做图ce using a markup language, use CSS style sheets to define appearance and use JavaScript for behavior. You also have access to programming inte易做图ces for reading and writing to remote content over the network and for calling web services. Unlike HTML however, XUL provides a rich set of user inte易做图ce widgets for creating menus, 易做图s, tabbed panels, and hierarchical trees to give a few examples.
XUL被设计用来创建Mozila应用程序的用户界面,包括网页浏览器,邮件客户端和页面编辑器。XUL可以被用来创建这几种应用程序。但是,它同样可以被用来开发网页应用程序,比如,当你需要能够获得网络资源时,并且需要提供更加丰富的用户界面。就像HTML,用XUL你可以使用语言创建一个界面,使用CSS层叠样式表来定义表现层,并且使用JavaScript来定义行为。你同样具有界面编程的访问权力通过网络来读、写远端的内容,还用来申请网页服务。但不同于HTML,XUL提供丰富的用户界面部件集,比如用来创建菜单,工具栏,tab面板,和树型结构。
This means you don't have to look for third party code or include a large block of JavaScript in your application just to handle a popup menu. XUL has all of these elements built-in. In addition, the elements are designed to look and feel just like those on the user's native platform, even supporting OS level themes in Windows XP and MacOS X. Or, if you prefer, you can use standard CSS to create your own look. The XUL widgets also support localization and have support for accessibility using OS level accessiblity inte易做图ces.
这意味着你不用搜索第3方代码或在你的应用程序中包含大段儿的JavaScript来处理一个弹出式菜单。XUL内置了所有的这些组件。而且,这些组件被设计成外观和感受就像用户本地平台上的组件一模一样,甚至支持Windows XP和MacOS X操作系统级的样式。或者如果你愿意,你可以使用标准的CSS来创建你自己的外观。XUL组件同样支持本地化,并且支持操作系统级的可访问界面。
What is XUL?
什么是XUL?
XUL is an XML language and you can use numerous existing standards including XSLT, XPath and DOM functions to manipulate a user inte易做图ce, all supported directly by Gecko. In fact, XUL is powerful enough that the entire user inte易做图ce in the Mozilla application is implemented in XUL.
XUL是XML语言,并且你可以使用大量的现存的标准,包括XSLT, XPath和DOM功能来操作用户界面,全部都由Gecko直接支持。事实上,XUL足够强大以致Mozilla应用程序的全部的用户界面都可以在XUL下执行。
In addition to the many built-in user inte易做图ce widgets available in XUL, you may create additional custom widgets using a related language called the Extensible Bindings Language (XBL). This language may be used to create custom tags and implement custom functionality.
而且XUL体统了许多内置的用户界面组件,你可以使用相关联语言可扩展易做图语言(XBL)来创建附加的自定义组件。这个语言可以用来创建自定义的tag和执行自定义的功能。
XUL applications may be either opened directly from a remote Web site, or may be downloaded by the user and installed. Mozilla's XPInstall technology allows an application to be placed on a remote site and installed using only a couple of clicks of the mouse. No searching though the file system for an installer or stepping through a lengthy install process. The benefit of installing an application is lowered security restrictions so that applications may read and write files, and access user preferences and system information.
XUL应用程序既可以直接由远端的网站开放,也可以由用户来下载安装。Mozilla的XPInstall技术允许位于远端站点的应用程序仅仅通过轻点几下鼠标就安装好了。不用搜索文件系统来获得安装程序,也不用经历漫长的安装过程。安装一个应用程序的好处是较低的安全限制,因此应用程序可以读、写文件,并且获得用户参数选择和系统信息。
XUL may also be used to create stand alone applications that embed the Gecko engine or may be used as part of the browser. A feature in XUL called an overlay allows a third party to create extensions to the browser itself, for example to add a custom 易做图, change menus, or add other features. This feature is popular in Mozilla Firefox -- there are almost 100 extensions available. Mozilla's upcoming mail client Thunderbird also has a number of extensions available. In fact, any XUL application can support extensions.
XUL同样可以用来创建独立的应用程序,嵌入在Gecko引擎中或用作浏览器的一部分。XUL的一个特性是覆盖(overlay)允许第3方创建针对浏览器自身的扩展,比如增添一个自定义工具栏,改变菜单,或添加其他的特性。这个特性在Mozilla FireFox中很流行——大概有100个扩展。Mozilla的即将面世的邮件客户端Thunderbird(现在我已经爱上Thunderbird1.0,不再使用OE)同样拥有大量的扩展。事实上,任何一款XUL应用程序都可以支持扩展。
Gecko also supports various Web Services technologies such as XML-RPC, SOAP and WSDL. These technologies have been used recently to create an application to browse for products on amazon.com.
Gecko同样可以支持大多数的网页服务技术,诸如XML-RPC, SOAP和WSDL。这些技术已经被用来为amazon网站创建针对浏览器的应用程序。
Standards and other Technologies Supported
标准的和其他技术的支持
The following is a list of technologies supported by Gecko and can be used by XUL applications (not including XUL itself):
下面列出了Gecko支持的技术并且可以被XUL使用的应用程序(不包括XUL自身):
• HTML 4.0 and XHTML
• CSS2 and some of CSS3
• DOM2 and some of DOM3
• XML
• MathML
• RDF
• XSLT
• XPath
• Simple XLinks
• XPointer
• XML Base
• FIXPtr
• XML-RPC
• SOAP (Simple Object Access Protocol)
• WSDL (Web Services Description Language)
• ECMAScript/Javascript
• XBL (eXtensible Bindings Language)(可扩展的嵌入式语言)
• GIF, JPG, PNG, BMP, ICO images
• HTTP 1.1
This list doesn't include all of the mail related features used by Mozilla Mail which you could also use in your own application to support POP3, IMAP and LDAP.
这个清单没有包含所有被Mozilla Mail使用的相关联的邮件特性,你同样可以使用你自己的应用程序来支持POP3,IMAP和LDAP。
XUL as an Application Platform
XUL作为一个应用程序平台
XUL and Gecko make an excellent choice for building sophisticated Web applications. It provides a rich user inte易做图ce toolkit,