Francis J. Lacoste > Apache-iNcom-0.09 > Apache::iNcom::Localizer

Download:
Apache-iNcom-0.09.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  

NAME ^

Apache::iNcom::Localizer - Object responsible for the localization of the generated request.

SYNOPSIS ^

    my $file    = $Localizer->find_localized_file( $filename );
    my $bundle  = $Localizer->get_handle( "Site_L10N" );

DESCRIPTION ^

This module is used for localization in the Apache::iNcom framework. It should be used for operation which are locale sensitive. (Messages display, currency and date formatting, etc.)

INITIALIZATION ^

An object is automatically initialized on each request by the Apache::iNcom framework. The list of preferred languages is determined by using the Accept-Language HHTP header. The default language is set to the one specified in the configuration. It is accessible through the $Localizer gobal variable in the Apache::iNcom pages.

METHODS ^

default_lang

Get or set the default language.

preferred_lang

Get or set the user's preferred language.

preferred_langs

Get or set the user's preferred languages in order of preferences.

get_handle ( $base_package )

This method will initialize a Locale::Maketext object of the $base_package using the user's list of preferred languages. This object should be used for localization of messages and such. See that module documentation for details (or the article about it The Perl Journal #8).

find_localized_file ( $filename )

This method will try to find a properly localized version of the $filename. Localized version of the file name should have the same name with the language extension appended. If the file without extension exists, it is assumed to be in the default language.

    Ex: file.txt        -> English
        file.txt.fr     -> French
        file.txt.es     -> Spanish
        file.txt.fr-CA  -> French Canadian

AUTHOR ^

Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

SEE ALSO ^

Locale::Maketext(3) Apache::iNcom(3) Apache::iNcom::Request(3) I18N::LangTags(3)