
i18n and L10n with DHTML
.
| Index | Für diese Seite gibt es noch keine deutsche Übersetzung. i18n and L10n with DHTMLi18n und L10n mit DHTMLThis article describes how to implement i18n (internatinalization) and L10n (localization) on websites with HTML, CSS and JavaScript. HTML
We use the HTML-attribute
The <body>'s Furthermore we need control elements to select the language. One solution is to use anchor-tags.
CSS
We include the following CSS style rules either via the
First we define a rule to hide each and every element inside the body
with a language attribute set. Thereafter we define rules using the
JavaScript
The function
Internet ExplorerAs expected, it's not that easy with IE. Internet Explorer 7 doesn't support the
Internet Explorer 6, moreover, isn't able to handle CSS attribute selectors.
A workaround is to use class names instead of the
The JavaScript code has to be extended, too. Additional code for the
function
After loading the page we have to set the class name for each element
with a
Pro and contraYou do not need server-side code to determine the language to use and to extract the corresponding text from a storage. On the other side, the document size grows and each languages is loaded, if needed or not. Sample
|
== # conf # ==