Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Attributes

oxLang Class Reference

Inheritance diagram for oxLang:
Collaboration diagram for oxLang:

List of all members.

Public Member Functions

 resetBaseLanguage ()
 getBaseLanguage ()
 getObjectTplLanguage ()
 getTplLanguage ()
 getEditLanguage ()
 getLanguageArray ($iLanguage=null, $blOnlyActive=false, $blSort=false)
 getAdminTplLanguageArray ()
 getLanguageAbbr ($iLanguage=null)
 getLanguageNames ()
 getLanguageIds ()
 registerAdditionalLangFile ($sFile)
 translateString ($sStringToTranslate, $iLang=null, $blAdminMode=null)
 getSimilarByKey ($sKey, $iLang=null, $blAdmin=null)
 formatCurrency ($dValue, $oActCur=null)
 formatVat ($dValue, $oActCur=null)
 getLanguageTag ($iLanguage=null)
 validateLanguage ($iLang=null)
 setBaseLanguage ($iLang=null)
 setTplLanguage ($iLang=null)
 getName ()
 getFormLang ()
 getUrlLang ($iLang=null)
 processUrl ($sUrl, $iLang=null)
 detectLanguageByBrowser ()
 getMultiLangTables ()
 getSeoReplaceChars ($iLang)

Static Public Member Functions

static getInstance ()

Protected Member Functions

 _collectSimilar ($aData, $sKey, $aCollection=array())
 _recodeLangArray ($aLangArray, $sCharset, $blRecodeKeys=false)
 _getLangFilesPathArray ($blAdmin, $iLang)
 _getLangFileCacheName ($blAdmin, $iLang, $aLangFiles=null)
 _getLanguageFileData ($blAdmin=false, $iLang=0, $aLangFiles=null)
 _getLanguageMap ($iLang, $blAdmin=null)
 _getCacheLanguageId ($blAdmin, $iLang=null)
 _getLangTranslationArray ($iLang=null, $blAdmin=null, $aLangFiles=null)
 _readTranslateStrFromTextFile ($sStringToTranslate, $iLang=null, $blIsAdmin=null)
 _sortLanguagesCallback ($a1, $a2)
 _getActiveModuleInfo ()

Protected Attributes

 $_sName = 'lang'
 $_iBaseLanguageId = null
 $_iTplLanguageId = null
 $_iEditLanguageId = null
 $_aLangCache = array()
 $_aAdminTplLanguageArray = null
 $_aLangAbbr = null
 $_aAdditionalLangFiles = array()
 $_aLangMap = array()
 $_aActiveModuleInfo = null

Static Private Attributes

static $_instance = null

Detailed Description

Language related utility class

Definition at line 6 of file oxlang.php.


Member Function Documentation

oxLang._collectSimilar ( aData,
sKey,
aCollection = array() 
) [protected]

Iterates through given array ($aData) and collects data if array key is similar as searchable key ($sKey*). If you pass $aCollection, it will be appended with found items

Parameters:
array $aData array to search in
string $sKey key to look for (looking for similar with strpos)
array $aCollection array to append found items [optional]
Returns:
array

Definition at line 507 of file oxlang.php.

oxLang._getActiveModuleInfo (  )  [protected]

Returns active module Ids

Returns:
array

Definition at line 1219 of file oxlang.php.

oxLang._getCacheLanguageId ( blAdmin,
iLang = null 
) [protected]

Returns current language cache language id

Parameters:
bool $blAdmin admin mode
int $iLang language id [optional]
Returns:
int

Definition at line 947 of file oxlang.php.

oxLang._getLangFileCacheName ( blAdmin,
iLang,
aLangFiles = null 
) [protected]

Returns language cache file name

Parameters:
bool $blAdmin admin or not
int $iLang current language id
array $aLangFiles language files to load [optional]
Returns:
string

Definition at line 829 of file oxlang.php.

oxLang._getLangFilesPathArray ( blAdmin,
iLang 
) [protected]

Returns array with paths where language files are stored

Parameters:
bool $blAdmin admin mode
int $iLang active language
Returns:
array

Definition at line 713 of file oxlang.php.

oxLang._getLangTranslationArray ( iLang = null,
blAdmin = null,
aLangFiles = null 
) [protected]

get language array from lang translation file

Parameters:
int $iLang optional language
bool $blAdmin admin mode switch
array $aLangFiles language files to load [optional]
Returns:
array

Definition at line 969 of file oxlang.php.

oxLang._getLanguageFileData ( blAdmin = false,
iLang = 0,
aLangFiles = null 
) [protected]

Returns language cache array

Parameters:
bool $blAdmin admin or not [optional]
int $iLang current language id [optional]
array $aLangFiles language files to load [optional]
Returns:
array

Definition at line 848 of file oxlang.php.

oxLang._getLanguageMap ( iLang,
blAdmin = null 
) [protected]

Returns language map array

Parameters:
int $iLang language index
bool $blAdmin admin mode [default NULL]
Returns:
array

Definition at line 920 of file oxlang.php.

oxLang._readTranslateStrFromTextFile ( sStringToTranslate,
iLang = null,
blIsAdmin = null 
) [protected]

translates a given string

Parameters:
string $sStringToTranslate string that should be translated
int $iLang language id (optional)
bool $blIsAdmin admin mode switch (default null)
Deprecated:
, text files should not be used any more (2011.07.06)
Returns:
string translation

Definition at line 1002 of file oxlang.php.

oxLang._recodeLangArray ( aLangArray,
sCharset,
blRecodeKeys = false 
) [protected]

Goes through language array and recodes its values. Returns recoded data

Parameters:
array $aLangArray language data
string $sCharset charset which was used while making file
bool $blRecodeKeys leave keys untouched or recode it
Returns:
array

Definition at line 689 of file oxlang.php.

oxLang._sortLanguagesCallback ( a1,
a2 
) [protected]

Language sorting callback function

Parameters:
object $a1 first value to check
object $a2 second value to check
Returns:
bool

Definition at line 1058 of file oxlang.php.

oxLang.detectLanguageByBrowser (  ) 

Detect language by user browser settings. Returns language ID if detected, otherwise returns null.

Returns:
int

Definition at line 1146 of file oxlang.php.

oxLang.formatCurrency ( dValue,
oActCur = null 
)

Returns formatted number, according to active currency formatting standards.

Parameters:
double $dValue Plain price
object $oActCur Object of active currency
Returns:
string

Definition at line 562 of file oxlang.php.

oxLang.formatVat ( dValue,
oActCur = null 
)

Returns formatted vat value, according to formatting standards.

Parameters:
double $dValue Plain price
object $oActCur Object of active currency
Returns:
string

Definition at line 578 of file oxlang.php.

oxLang.getAdminTplLanguageArray (  ) 

Returns languages array containing possible admin template translations

Returns:
array

Definition at line 322 of file oxlang.php.

oxLang.getBaseLanguage (  ) 

Returns active shop language id

Returns:
string

Definition at line 125 of file oxlang.php.

oxLang.getEditLanguage (  ) 

Returns editing object working language id

Returns:
string

Definition at line 228 of file oxlang.php.

oxLang.getFormLang (  ) 

Returns form hidden language parameter

Returns:
string

Definition at line 1078 of file oxlang.php.

static oxLang.getInstance (  )  [static]

resturns a single instance of this class

Returns:
oxLang

Definition at line 90 of file oxlang.php.

oxLang.getLanguageAbbr ( iLanguage = null  ) 

Returns selected language abbervation

Parameters:
int $iLanguage language id [optional]
Returns:
string

Definition at line 374 of file oxlang.php.

oxLang.getLanguageArray ( iLanguage = null,
blOnlyActive = false,
blSort = false 
)

Returns array of available languages.

Parameters:
integer $iLanguage Number if current language (default null)
bool $blOnlyActive load only current language or all
bool $blSort enable sorting or not
Returns:
array

Definition at line 265 of file oxlang.php.

oxLang.getLanguageIds (  ) 

Returns available language IDs (abbervations)

Returns:
array

Definition at line 417 of file oxlang.php.

oxLang.getLanguageNames (  ) 

getLanguageNames returns array of language names e.g. array('Deutch', 'English')

public

Returns:
array

Definition at line 401 of file oxlang.php.

oxLang.getLanguageTag ( iLanguage = null  ) 

According to user configuration forms and return language prefix.

Parameters:
integer $iLanguage User selected language (default null)
Returns:
string

Definition at line 599 of file oxlang.php.

oxLang.getMultiLangTables (  ) 

Returns all multi language tables

Returns:
array

Definition at line 1168 of file oxlang.php.

oxLang.getName (  ) 

Returns language id param name

Returns:
string

Definition at line 1068 of file oxlang.php.

oxLang.getObjectTplLanguage (  ) 

Returns language id used to load objects according to current template language

Returns:
int

Definition at line 194 of file oxlang.php.

oxLang.getSeoReplaceChars ( iLang  ) 

Get SEO spec. chars replacement list for current language

Parameters:
int $iLang language ID
Returns:
null

Definition at line 1196 of file oxlang.php.

oxLang.getSimilarByKey ( sKey,
iLang = null,
blAdmin = null 
)

Returns array( "MY_TRANSLATION_KEY" => "MY_TRANSLATION_VALUE", ... ) by given filter "MY_TRANSLATION_" from language files

Parameters:
string $sKey key to look
int $iLang language files to search [optional]
bool $blAdmin admin/non admin mode [optional]
Returns:
array

Definition at line 528 of file oxlang.php.

oxLang.getTplLanguage (  ) 

Returns active shop templates language id If it is not an admin area, template language id is same as base shop language id

Returns:
string

Definition at line 214 of file oxlang.php.

oxLang.getUrlLang ( iLang = null  ) 

Returns url language parameter

Parameters:
int $iLang lanugage id [optional]
Returns:
string

Definition at line 1094 of file oxlang.php.

oxLang.processUrl ( sUrl,
iLang = null 
)

Is needed appends url with language parameter Direct usage of this method to retrieve end url result is discouraged - instead see oxUtilsUrl.processUrl

Parameters:
string $sUrl url to process
int $iLang language id [optional]
See also:
oxUtilsUrl.processUrl
Returns:
string

Definition at line 1116 of file oxlang.php.

oxLang.registerAdditionalLangFile ( sFile  ) 

register additional language files to be loaded for this session

Parameters:
string $sFile file name
Returns:
null
Deprecated:
since 2012-01-24 marked in version 4.5.7

Definition at line 444 of file oxlang.php.

oxLang.resetBaseLanguage (  ) 

resetBaseLanguage resets base language id cache

public

Returns:
void

Definition at line 115 of file oxlang.php.

oxLang.setBaseLanguage ( iLang = null  ) 

Set base shop language

Parameters:
int $iLang Language id
Returns:
null

Definition at line 640 of file oxlang.php.

oxLang.setTplLanguage ( iLang = null  ) 

Validates and sets templates language id

Parameters:
int $iLang Language id
Returns:
null

Definition at line 662 of file oxlang.php.

oxLang.translateString ( sStringToTranslate,
iLang = null,
blAdminMode = null 
)

Searches for translation string in file and on success returns translation, otherwise returns initial string.

Parameters:
string $sStringToTranslate Initial string
int $iLang optional language number
bool $blAdminMode on special case you can force mode, to load language constant from admin/shops language file
Exceptions:
oxLanguageException in debug mode
Returns:
string

Definition at line 466 of file oxlang.php.

oxLang.validateLanguage ( iLang = null  ) 

Validate language id. If not valid id, returns default value

Parameters:
int $iLang Language id
Returns:
int

Definition at line 617 of file oxlang.php.


Member Data Documentation

oxLang.$_aActiveModuleInfo = null [protected]

Definition at line 83 of file oxlang.php.

oxLang.$_aAdditionalLangFiles = array() [protected]

Definition at line 69 of file oxlang.php.

oxLang.$_aAdminTplLanguageArray = null [protected]

Definition at line 55 of file oxlang.php.

oxLang.$_aLangAbbr = null [protected]

Definition at line 62 of file oxlang.php.

oxLang.$_aLangCache = array() [protected]

Definition at line 48 of file oxlang.php.

oxLang.$_aLangMap = array() [protected]

Definition at line 76 of file oxlang.php.

oxLang.$_iBaseLanguageId = null [protected]

Definition at line 27 of file oxlang.php.

oxLang.$_iEditLanguageId = null [protected]

Definition at line 41 of file oxlang.php.

oxLang.$_instance = null [static, private]

Definition at line 13 of file oxlang.php.

oxLang.$_iTplLanguageId = null [protected]

Definition at line 34 of file oxlang.php.

oxLang.$_sName = 'lang' [protected]

Definition at line 20 of file oxlang.php.


The documentation for this class was generated from the following file: