NAME

Lang - A module for internationalization

SYNOPSIS

use Lang;
use Lang::SQL;

Lang::init(new Lang::SQL("dbi:Pg:dbname=zclass;host=localhost","test","testpass");

Lang::language("english");

print _T("This is a test");

Lang::language("dutch");

print _T("This is a test");

ABSTRACT

This module provides simple string based internationalization support. It exports a '_T' function that can be used for all text that need displayed. It can work with different backends, e.g. SQL or file based backends.

DESCRIPTION

With this module simple string based internationalization can be made through uses of '_T' function calls. Strings will be looked up by a backend and can be subsequentially cached by the same backend. For an interface to the backend see Lang::SQL.

Lang::init(backend) --> void

This initializes the Lang module with a supported backend. This function must be called before any use of the _T() function.

Lang::language(language) --> void

This sets the current language to use. Languages are free to be named, but it is recommended to use common categories as provided in ISO639, e.g. 'en', 'nl', 'no', 'pl', etc. The language is default initialized to 'en' (for category english).

If language is set to "" (empty string), no translations must be done by function _T().

_T(text) --> string

This function looks up 'text' in the current backend and returns a translation for 'text' given the provided language.

This function actually only calls the backend function backend-translate($language,$text)>; nothing else. The backend must to solve the rest.

EXPORT

_T() is exported.

SEE ALSO

Lang::SQL, ISO639 (google works).

AUTHOR

Hans Oesterholt-Dijkema <oesterhol@cpan.org>

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under LGPL terms.