MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Specifikace Strana 108

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 504
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 107
108 Extending Dreamweaver
Do not write JavaScript code in the HTML files except for required event handlers. This
eliminates the need to fix a bug multiple times for multiple translations after the HTML
files are replicated and translated into other languages.
XML String files
Store all strings in XML files in the Dreamweaver Configuration/Strings folder. If you install
many related extension files, this lets you share all strings in a single XML file. If applicable,
this also lets you refer to the same string from both C++ and JavaScript extensions.
You could create a file called myExtensionStrings.xml. The following example shows the
format of the file:
<strings>
<!-- errors for feature X -->
<string id="featureX/subProblemY" value="There was a with X when you did
Y. Try not to do Y!"/>
<string id="featureX/subProblemZ" value="There was another problem with
X, regarding Z. Don't ever do Z!"/>
</strings>
Now your JavaScript files can refer to these translatable strings by calling the
dw.loadString() function, as shown in the following example:
function initializeUI()
{
...
if (problemYhasOccured)
{
alert(dw.loadString("featureX/subProblemY");
}
}
You can use slash (/) characters in your string identifiers, but do not use spaces. Using slashes,
you can create a hierarchy to suit your needs, and include all the strings in a single XML file.
NOTE
Files that begin with cc in the Configuration/Strings folder are Contribute files. For
example, the file ccSiteStrings.xml is a Contribute file.
Zobrazit stránku 107
1 2 ... 103 104 105 106 107 108 109 110 111 112 113 ... 503 504

Komentáře k této Příručce

Žádné komentáře