Localization of HTML documents?
XML documents can be localized by referring to an external DTD document that contains the translations. For example in Mozilla XULRunner it looks like this:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://configpanel/locale/configpanel.dtd">
<window title="&CONFIG_PA开发者_开发百科NEL;">
<label value="&WELCOME_TEXT;"/>
</window>
I've tried it in a HTML document but it didn't seem to work. Is this supposed to work for HTML documents? Or is there a similar mechanism that can be used here?
This isn't supposed to work in HTML. I suggest you just do the localisation on the server-side.
I'm going to go right ahead and say that that isn't really a good way of localizing XML, and it probably won't work for HTML in most browsers.
The canonical way of localizing XML documents is using the xml:lang
attribute.
精彩评论