<<

NAME

C4::Languages - Perl Module containing language list functions for Koha

SYNOPSIS

use C4::Languages;

DESCRIPTION

FUNCTIONS

getFrameworkLanguages

Returns a reference to an array of hashes:

 my $languages = getFrameworkLanguages();
 for my $language(@$languages) {
    print "$language->{language_code}\n"; # language code in iso 639-2
    print "$language->{language_name}\n"; # language name in native script
    print "$language->{language_locale_name}\n"; # language name in current locale
 }

getTranslatedLanguages

Returns a reference to an array of hashes:

 my $languages = getTranslatedLanguages();
 print "Available translated languages:\n";
 for my $language(@$trlanguages) {
    print "$language->{language_code}\n"; # language code in iso 639-2
    print "$language->{language_name}\n"; # language name in native script
    print "$language->{language_locale_name}\n"; # language name in current locale
 }

getAllLanguages

Returns a reference to an array of hashes:

 my $alllanguages = getAllLanguages();
 print "Available translated languages:\n";
 for my $language(@$alllanguages) {
    print "$language->{language_code}\n";
    print "$language->{language_name}\n";
    print "$language->{language_locale_name}\n";
 }

This routine is a wrapper for getLanguages().

getLanguages

    my $lang_arrayref = getLanguages([$lang[, $isFiltered]]);

Returns a reference to an array of hashes of languages.

- If no parameter is passed to the function, it returns english languages names - If a $lang parameter conforming to RFC4646 syntax is passed, the function returns languages names translated in $lang If a language name is not translated in $lang in database, the function returns english language name - If $isFiltered is set to true, only the detail of the languages selected in system preferences AdvanceSearchLanguages is returned.

_get_themes

Internal function, returns an array of all available themes.

  (@themes) = &_get_themes('opac');
  (@themes) = &_get_themes('intranet');

_get_language_dirs

Internal function, returns an array of directory names, excluding non-language directories

_build_languages_arrayref

Internal function for building the ref to array of hashes

FIXME: this could be rewritten and simplified using map

regex_lang_subtags

This internal sub takes a string composed according to RFC 4646 as an input and returns a reference to a hash containing keys and values for ( language, script, region, variant, extension, privateuse )

getlanguage

    Select a language based on the URL parameter 'language', a cookie,
    syspref available languages & browser

get_rfc4646_from_iso639

    Select a language rfc4646 code given an iso639 code

AUTHOR

Joshua Ferraro

<<