ePages 6.11.0 - DE_EPAGES/Object/API/Language.pm

Package DE_EPAGES::Object::API::Language

interface for conversion between ISO-639 language codes and internal language ids. This is necessary, because multiple language codes map to the same language.

@EXPORT_OK
GetPKeyLanguageByCode
ExistsLanguageByCode
GetCodeByLanguageID
GetCurrentLanguageID

Functions

ExistsLanguageByCode
GetCodeByLanguageID
GetCurrentLanguageID
GetPKeyLanguageByCode

ExistsLanguageByCode

Returns true if the language with the specified language code exists in the database.

Syntax
$Exists = ExistsLanguageByCode( $LanguageCode );
if( ExistsLanguageByCode( 'fi' ) ) { ... }
Input
$LanguageCode (string)
ISO-639 language code, case sensitive
Return
$Exists (boolean)
true if the language code exists

GetCodeByLanguageID

Returns the ISO-639 language code by the LanguageID. Returns the 2-letter code if it exists, otherwise returns the 3-letter code.

Syntax
$Code = GetCodeByLanguageID( $LanguageID );
Example
$Code = GetCodeByLanguageID( 1 );
Input
$LanguageID (integer)
internal language id
Return
$LanguageCode (string)
ISO-639 language code, case sensitive

GetCurrentLanguageID

Returns the current internal language id of the process.

Syntax
$LanguageID = GetCurrentLanguageID();
Return
$LanguageID (integer)
internal language id

GetPKeyLanguageByCode

Returns the language id by ISO-639 language code. The code can be a 2-letter or 3-letter code.

Syntax
$LanguageID = GetPKeyLanguageByCode( $LanguageCode );
Example
$LanguageID = GetPKeyLanguageByCode( 'enu' );
$LanguageID = GetPKeyLanguageByCode( 'it' );
Input
$LanguageCode (string)
ISO-639 language code, case sensitive
Return
$LanguageID (integer)
internal language id