CGI::FormMagick::L10N - localization routines for FormMagick


  use CGI::FormMagick::L10N;


L10N (Localisation) is the name given to the process of providing translations into another language. The previous step to this is I18N (internationalisation) which is the process of making an application ready to accept the translations.

We've done the work of I18N for you, so all you have to do is provide translations for your apps. This is done using the <lexicon> XML element, like so:


    <lexicon lang="fr">

Localisation preferences are picked up from the HTTP_ACCEPT_LANGUAGE environment variable passed by the user's browser. In Netscape, you set this by choosing "Edit, Preferences, Navigator, Languages" and then choosing your preferred language.

Localisation is performed on:

  • Form titles

  • Page titles and descriptions

  • Field labels and descriptions

  • Validation error messages

If you wish to localise other textual information such as your HTML Templates, you will have to explicitly call the l10n routines.



Translates a string into the end-user's preferred language by checking their HTTP_ACCEPT_LANG variable and looking up a lexicon hash for that language (if it exists). If no translation can be found, returns the original string untranslated.

WARNING WARNING WARNING: The internals of this routine will change significantly in version 0.60, when we remove Locale::Maketext from the equation. However, its output should still be the same. Just FYI.


print out lexicons to check whether they're what you think they are this is mostly for debugging purposes. If you have DEBUG set to 1 in your call to the new() method, you'll see a link at the bottom of each page that says "Check L10N". This is the subroutine that's called when you follow that link.


Attempts to find a suitable localisation lexicon for use, and returns it as a hash.


Given a messy lexicon hashref, clean it up into a nice neat hash of base/translation pairs.


Picks up the preferred language(s) from $ENV{HTTP_ACCEPT_LANGUAGE}


The general documentation for FormMagick (perldoc CGI::FormMagick)

More information about FormMagick may be found at

1 POD Error

The following errors were encountered while parsing the POD:

Around line 10:

=pod directives shouldn't be over one line long! Ignoring all 2 lines of content