NAME

PEF::Front::NLS - Localization support

SYNOPSIS

my $comments_number_text = msg_get_n(
  $context->{lang}, 
  '$1 comments', 
  $comment_count, 
  $comment_count
)->{message};

DESCRIPTION

Sometimes application has to return localized messages.

FUNCTIONS

msg_get($lang, $msgid, @params)

Returns localized text for message $msgid and language $lang. It supports parameterized messages like:

my $message = msg_get($context->{lang}, 'Hello $1', $user->{name});.

msg_get_n($lang, $msgid, $num, @params)

This works like Cmsg_get> but supports singular/plural forms. $num is used to select right form.

msg_peek($lang, $msgid)

Checks whether there's localized text for given $lang, $msgid in database.

guess_lang($request)

Returns short (ISO 639-1) language code. This function automatically detect language based on URL, HTTP headers, cookies and Geo IP. You can turn it off setting cfg_no_multilang_support to true. When it can't detect language or language detection is off then it returns cfg_default_lang.

AUTHOR

This module was written and is maintained by Anton Petrusevich.

Copyright and License

Copyright (c) 2016 Anton Petrusevich. Some Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.