OXID eShop CE  4.9.7
 All Classes Files Functions Variables Pages
oxLang Class Reference
+ Inheritance diagram for oxLang:
+ Collaboration diagram for oxLang:

Public Member Functions

 setIsTranslated ($blIsTranslated=true)
 isTranslated ()
 resetBaseLanguage ()
 getBaseLanguage ()
 getObjectTplLanguage ()
 getTplLanguage ()
 getEditLanguage ()
 getLanguageArray ($iLanguage=null, $blOnlyActive=false, $blSort=false)
 getAdminTplLanguageArray ()
 getLanguageAbbr ($iLanguage=null)
 getLanguageNames ()
 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)
 getAllShopLanguageIds ()
 getLanguageIds ($iShopId=null)
 getActiveShopLanguageIds ()
- Public Member Functions inherited from oxSuperCfg
 __call ($sMethod, $aArgs)
 __construct ()
 getConfig ()
 setConfig ($oConfig)
 getSession ()
 setSession ($oSession)
 getUser ()
 setUser ($oUser)
 isAdmin ()
 setAdminMode ($blAdmin)

Protected Member Functions

 _collectSimilar ($aData, $sKey, $aCollection=array())
 _recodeLangArray ($aLangArray, $sCharset, $blRecodeKeys=false)
 _getLangFilesPathArray ($iLang)
 _getAdminLangFilesPathArray ($iLang)
 _appendLangFile ($aLangFiles, $sFullPath, $sFilePattern="lang")
 _appendCustomLangFiles ($aLangFiles, $sLang, $blForAdmin=false)
 _appendModuleLangFiles ($aLangFiles, $aModulePaths, $sLang, $blForAdmin=false)
 _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)
 _sortLanguagesCallback ($a1, $a2)
 _getActiveModuleInfo ()
 _getDisabledModuleInfo ()
 _getBrowserLanguage ()
 _getLanguageIdsFromDatabase ($iShopId=null)
 _getConfigLanguageValues ($sLanguageParameterName, $iShopId=null)
 _selectLanguageParamValues ($sParamName, $sShopId=null)
 _getLanguageIdsFromLanguageParamsArray ($aLanguageParams)
 _getLanguageIdsFromLanguagesArray ($aLanguages)

Protected Attributes

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

Additional Inherited Members

- Static Protected Attributes inherited from oxSuperCfg
static $_oConfig = null
static $_oSession = null
static $_oRights = null
static $_oActUser = null
static $_blIsAdmin = null

Detailed Description

Language related utility class

Definition at line 6 of file oxlang.php.

Member Function Documentation

oxLang::_appendCustomLangFiles (   $aLangFiles,
  $sLang,
  $blForAdmin = false 
)
protected

Appends Custom language files cust_lang.php

Parameters
array$aLangFilesexisting language files
string$sLanglanguage abbreviation
bool$blForAdminadd files for admin
Returns
array

Definition at line 769 of file oxlang.php.

oxLang::_appendLangFile (   $aLangFiles,
  $sFullPath,
  $sFilePattern = "lang" 
)
protected

Appends lang or options files if exists, except custom lang files

Parameters
array$aLangFilesexisting language files
string$sFullPathpath to language files to append
string$sFilePatternfile pattern to search for, default is "lang"
Returns
array

Definition at line 746 of file oxlang.php.

oxLang::_appendModuleLangFiles (   $aLangFiles,
  $aModulePaths,
  $sLang,
  $blForAdmin = false 
)
protected

Appends module lang or options files if exists

Parameters
array$aLangFilesexisting language files
array$aModulePathsmodule language file paths
string$sLanglanguage abbreviation
bool$blForAdminadd files for admin
Returns
array

Definition at line 800 of file oxlang.php.

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$aDataarray to search in
string$sKeykey to look for (looking for similar with strpos)
array$aCollectionarray to append found items [optional]
Returns
array

Definition at line 446 of file oxlang.php.

oxLang::_getActiveModuleInfo ( )
protected

Returns active module Ids with paths

Returns
array

Definition at line 1174 of file oxlang.php.

oxLang::_getAdminLangFilesPathArray (   $iLang)
protected

Returns array with paths where admin language files are stored

Parameters
int$iLangactive language
Returns
array

Definition at line 706 of file oxlang.php.

oxLang::_getBrowserLanguage ( )
protected

Gets browser language.

Returns
string

Definition at line 1204 of file oxlang.php.

oxLang::_getCacheLanguageId (   $blAdmin,
  $iLang = null 
)
protected

Returns current language cache language id

Parameters
bool$blAdminadmin mode
int$iLanglanguage id [optional]
Returns
int

Definition at line 963 of file oxlang.php.

oxLang::_getConfigLanguageValues (   $sLanguageParameterName,
  $iShopId = null 
)
protected

Returns list of all language codes taken from config values of given 'aLanguages' (for all subshops)

Parameters
string$sLanguageParameterNamelanguage config parameter name
int$iShopIdshop id
Returns
array

Definition at line 1287 of file oxlang.php.

oxLang::_getDisabledModuleInfo ( )
protected

Returns active module Ids with paths

Returns
array

Definition at line 1189 of file oxlang.php.

oxLang::_getLangFileCacheName (   $blAdmin,
  $iLang,
  $aLangFiles = null 
)
protected

Returns language cache file name

Parameters
bool$blAdminadmin or not
int$iLangcurrent language id
array$aLangFileslanguage files to load [optional]
Returns
string

Definition at line 831 of file oxlang.php.

oxLang::_getLangFilesPathArray (   $iLang)
protected

Returns array with paths where frontend language files are stored

Parameters
int$iLangactive language
Returns
array

Definition at line 654 of file oxlang.php.

oxLang::_getLangTranslationArray (   $iLang = null,
  $blAdmin = null,
  $aLangFiles = null 
)
protected

get language array from lang translation file

Parameters
int$iLangoptional language
bool$blAdminadmin mode switch
array$aLangFileslanguage files to load [optional]
Returns
array

Definition at line 985 of file oxlang.php.

oxLang::_getLanguageFileData (   $blAdmin = false,
  $iLang = 0,
  $aLangFiles = null 
)
protected

Returns language cache array

Parameters
bool$blAdminadmin or not [optional]
int$iLangcurrent language id [optional]
array$aLangFileslanguage files to load [optional]
Returns
array

Definition at line 851 of file oxlang.php.

oxLang::_getLanguageIdsFromDatabase (   $iShopId = null)
protected

Gets language Ids for given shopId or for all subshops

Parameters
null$iShopId
Returns
array

Definition at line 1271 of file oxlang.php.

oxLang::_getLanguageIdsFromLanguageParamsArray (   $aLanguageParams)
protected

gets language code array from aLanguageParams array

Parameters
array$aLanguageParamsLanguage parameters
Returns
array

Definition at line 1341 of file oxlang.php.

oxLang::_getLanguageIdsFromLanguagesArray (   $aLanguages)
protected

gets language code array from aLanguages array

Parameters
array$aLanguagesLanguages
Returns
array

Definition at line 1359 of file oxlang.php.

oxLang::_getLanguageMap (   $iLang,
  $blAdmin = null 
)
protected

Returns language map array

Parameters
int$iLanglanguage index
bool$blAdminadmin mode [default NULL]
Returns
array

Definition at line 927 of file oxlang.php.

oxLang::_recodeLangArray (   $aLangArray,
  $sCharset,
  $blRecodeKeys = false 
)
protected

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

Parameters
array$aLangArraylanguage data
string$sCharsetcharset which was used while making file
bool$blRecodeKeysleave keys untouched or recode it
Returns
array

Definition at line 631 of file oxlang.php.

oxLang::_selectLanguageParamValues (   $sParamName,
  $sShopId = null 
)
protected

Returns array of all config values of given paramName

Parameters
string$sParamNameParameter name
string | null$sShopIdShop id
Returns
array

Definition at line 1316 of file oxlang.php.

oxLang::_sortLanguagesCallback (   $a1,
  $a2 
)
protected

Language sorting callback function

Parameters
object$a1first value to check
object$a2second value to check
Returns
bool

Definition at line 1015 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 1110 of file oxlang.php.

oxLang::formatCurrency (   $dValue,
  $oActCur = null 
)

Returns formatted number, according to active currency formatting standards.

Parameters
float$dValuePlain price
object$oActCurObject of active currency
Returns
string

Definition at line 501 of file oxlang.php.

oxLang::formatVat (   $dValue,
  $oActCur = null 
)

Returns formatted vat value, according to formatting standards.

Parameters
float$dValuePlain price
object$oActCurObject of active currency
Returns
string

Definition at line 519 of file oxlang.php.

oxLang::getActiveShopLanguageIds ( )

Returns available language IDs (abbreviations)

Returns
array

Definition at line 1249 of file oxlang.php.

oxLang::getAdminTplLanguageArray ( )

Returns languages array containing possible admin template translations

Returns
array

Definition at line 334 of file oxlang.php.

oxLang::getAllShopLanguageIds ( )

Returns available language IDs (abbreviations) for all sub shops

Returns
array

Definition at line 1219 of file oxlang.php.

oxLang::getBaseLanguage ( )

Returns active shop language id

Returns
string

Definition at line 135 of file oxlang.php.

oxLang::getEditLanguage ( )

Returns editing object working language id

Returns
string

Definition at line 240 of file oxlang.php.

oxLang::getFormLang ( )

Returns form hidden language parameter

Returns
string

Definition at line 1035 of file oxlang.php.

oxLang::getLanguageAbbr (   $iLanguage = null)

Returns selected language abbreviation

Parameters
int$iLanguagelanguage id [optional]
Returns
string

Definition at line 364 of file oxlang.php.

oxLang::getLanguageArray (   $iLanguage = null,
  $blOnlyActive = false,
  $blSort = false 
)

Returns array of available languages.

Parameters
integer$iLanguageNumber if current language (default null)
bool$blOnlyActiveload only current language or all
bool$blSortenable sorting or not
Returns
array

Definition at line 278 of file oxlang.php.

oxLang::getLanguageIds (   $iShopId = null)

Get current Shop language ids.

Parameters
int$iShopIdshop id
Returns
array

Definition at line 1233 of file oxlang.php.

oxLang::getLanguageNames ( )

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

public

Returns
array

Definition at line 384 of file oxlang.php.

oxLang::getLanguageTag (   $iLanguage = null)

According to user configuration forms and return language prefix.

Parameters
integer$iLanguageUser selected language (default null)
Returns
string

Definition at line 542 of file oxlang.php.

oxLang::getMultiLangTables ( )

Returns all multi language tables

Returns
array

Definition at line 1130 of file oxlang.php.

oxLang::getName ( )

Returns language id param name

Returns
string

Definition at line 1025 of file oxlang.php.

oxLang::getObjectTplLanguage ( )

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

Returns
int

Definition at line 203 of file oxlang.php.

oxLang::getSeoReplaceChars (   $iLang)

Get SEO spec. chars replacement list for current language

Parameters
int$iLanglanguage ID
Returns
null

Definition at line 1158 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$sKeykey to look
int$iLanglanguage files to search [optional]
bool$blAdminadmin/non admin mode [optional]
Returns
array

Definition at line 467 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 225 of file oxlang.php.

oxLang::getUrlLang (   $iLang = null)

Returns url language parameter

Parameters
int$iLanglanguage id [optional]
Returns
string

Definition at line 1052 of file oxlang.php.

oxLang::isTranslated ( )

Set translation state

Returns
bool

Definition at line 115 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$sUrlurl to process
int$iLanglanguage id [optional]
See Also
oxUtilsUrl::processUrl
Returns
string

Definition at line 1075 of file oxlang.php.

oxLang::resetBaseLanguage ( )

resetBaseLanguage resets base language id cache

public

Definition at line 125 of file oxlang.php.

oxLang::setBaseLanguage (   $iLang = null)

Set base shop language

Parameters
int$iLangLanguage id

Definition at line 581 of file oxlang.php.

oxLang::setIsTranslated (   $blIsTranslated = true)

Set translation state

Parameters
bool$blIsTranslatedState is string translated or not. Default true.

Definition at line 105 of file oxlang.php.

oxLang::setTplLanguage (   $iLang = null)

Validates and sets templates language id

Parameters
int$iLangLanguage id
Returns
null

Definition at line 603 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$sStringToTranslateInitial string
int$iLangoptional language number
bool$blAdminModeon special case you can force mode, to load language constant from admin/shops language file
Exceptions
oxLanguageExceptionin debug mode
Returns
string

Definition at line 408 of file oxlang.php.

oxLang::validateLanguage (   $iLang = null)

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

Parameters
int$iLangLanguage id
Returns
int

Definition at line 560 of file oxlang.php.

Member Data Documentation

oxLang::$_aActiveModuleInfo = null
protected

Definition at line 77 of file oxlang.php.

oxLang::$_aAdditionalLangFiles = array()
protected

Definition at line 63 of file oxlang.php.

oxLang::$_aAdminTplLanguageArray = null
protected

Definition at line 49 of file oxlang.php.

oxLang::$_aDisabledModuleInfo = null
protected

Definition at line 84 of file oxlang.php.

oxLang::$_aLangAbbr = null
protected

Definition at line 56 of file oxlang.php.

oxLang::$_aLangCache = array()
protected

Definition at line 42 of file oxlang.php.

oxLang::$_aLangMap = array()
protected

Definition at line 70 of file oxlang.php.

oxLang::$_blIsTranslated = true
protected

Definition at line 91 of file oxlang.php.

oxLang::$_iBaseLanguageId = null
protected

Definition at line 21 of file oxlang.php.

oxLang::$_iEditLanguageId = null
protected

Definition at line 35 of file oxlang.php.

oxLang::$_iObjectTplLanguageId = null
protected

Definition at line 98 of file oxlang.php.

oxLang::$_iTplLanguageId = null
protected

Definition at line 28 of file oxlang.php.

oxLang::$_sName = 'lang'
protected

Definition at line 14 of file oxlang.php.


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