Dynamically localise text

An example on how to dynamically localise text using a javascript function (gettext) to return strings in the users current language.

The function seaches a hash structure for at matching language and tag. If a match is found, the maching string is returned. If no match is found the tag - and a debug message is returned. Example:

	<script src="gettext.js">//Translation script</script>
	<script src="msg.js">//Message array</script>
	<script>document.write(gettext( 'test' ));</script>
will simply retur: Download the three files:
  1. This example
  2. The javascript code
  3. The message array which you'll have to update

Examples for gettext() localization

Location

2006-05-11 06:20:27/Erik Bachmann (e_bachmann@hotmail.com)