The translateMarkup() function
Although the getTranslatorInfo() function initializes the translator, the translateMarkup()
function actually does the work. As noted earlier, most translators rely on a custom C-level extension to
handle the inner workings of the function, but translateMarkup()provides the JavaScript shell.
The translateMarkup() function takes three arguments, which must be declared, but whose actual values
are provided by Dreamweaver:
n docName??”The file URL for the file to be translated.
n siteRoot??”The site root of the file to be translated. Should the file be outside the current site,
the value would be empty.
n docContent??”A text string with the code for the page to be translated.
1044
Extending Dreamweaver Part VII
Typically, the docContent text string is parsed using either JavaScript or a C-level extension within the
translateMarkup() function that returns the translated document. Dreamweaver then displays this
translated document.
Here??™s an excerpt of the translateMarkup() function from the ColdFusion translator:
function translateMarkup(docNameStr, siteRootStr, inStr) {
var outStr = ??????;
...
// translate
if (inStr.indexOf(???
var TM =
new TranslationManager(TRANSLATOR_CLASS, SERVER_MODEL_FOLDER, ??????);
TM.
Pages:
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772