Như đã đề cập ở chương trước, XUL tài liệu không chứa bất kỳ chuỗi chữ đó được trình bày cho người dùng. Thay vào đó, bạn nên xác định tất cả các chuỗi như vậy trong một file riêng biệt và tham khảo tài liệu XUL của họ. Điều này cho phép mở rộng được dễ dàng | 332 Part VI Creating Extensions and Themes function siteLedsPageLoaded var ledElement siteleds-statusbar-panel if 200 var prevContent gSiteLedsLastContent gSiteLedsLastContent if prevContent null prevContent gSiteLedsLastContent sitestate modified else sitestate ok setTimeout siteLedsCheckPage 900000 else sitestate error setTimeout siteLedsCheckPage 900000 load siteLedsCheckPage false Making the Extension Localizable As mentioned in the previous chapter XUL documents shouldn t contain any literal strings that are presented to the user. Instead you should define all such strings in a separate file and make your XUL document reference them. This allows the extension to be easily translated to a different language. All you need to do is to provide an additional file with the translated strings. Currently our XUL element looks like this statusbarpanel class statusbarpanel-iconic id siteleds-statusbar-panel tooltiptext SiteLeds Status Icon sitestate unknown insertbefore statusbar-display As you can see the SiteLeds Status Icon string is in English. If we want to translate our extension into a different language we will need to modify the XUL file and provide two different versions of our extension. What if the extension is translated into a dozen languages Luckily there is a better way. First we define all the strings in a separate DTD file. DTD files are usually used to define the structure of XML elements but they can also contain entities which are XML variables that define common strings and allow them to be reused. Let s define our string as an XML entity in the file ENTITY SiteLeds Status Icon We need to modify our XUL element accordingly statusbarpanel class statusbarpanel-iconic id siteleds-statusbar-panel tooltiptext sitestate .