tl;dr
I'd like to understand if it is possible (and, in case, how well supported) to use custom entities in HTML documents for localization purposes.
What I envision is doing something like this:
<!DOCTYPE html "/locales/en-us.ent">
<html>
<head>
<title>&contactus.title;</title>
</head>
<body>
<p>&contactus.youcanreach;<br>123, Example Road<br>12345 Example City</p>
<ul id="menu">
<li>&menu.home;</li>
<li>&menu.products;</li>
<li>&menu.contactus;</li>
</ul>
</body>
</html>
and all entities would be stored in a file (one for each language, en-us.ent in the example above) that gets included at the top of the document, e.g.
<!ENTITY menu.home "Home">
<!ENTITY menu.products "Products">
<!ENTITY menu.contactus "Contact us">
...
Eventually this could even be exapnded to HTML fragments (not sure if this is really allowed) that may be useful on all pages (such as headers, menus, etc.; in the example above, the whole <ul>
could be such a fragment)
Now, my understanding is that this is theoretically possible in XHTML, but I was wondering if this can be done also in HTML and, in case, how well browsers (and crawlers) would cope.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…