PHP 클래스 i18n, php-i18n

파일 보기 프로젝트 열기: philipp15b/php-i18n 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$appliedLang
$cacheFilePath
$cachePath string Cache file path This is the path for all the cache files. Best is an empty directory with no other files in it.
$fallbackLang string Remember to create a language file for the fallback!!
$filePath string Language file path This is the path for the language files. You must use the '{LANGUAGE}' placeholder for the language or the script wont find any language files.
$forcedLang string Forced language If you want to force a specific language define it here.
$isInitialized
$langFilePath
$mergeFallback boolean Merge in fallback language Whether to merge current language's strings with the strings of the fallback language ($fallbackLang).
$prefix string The class name of the compiled class that contains the translated texts.
$sectionSeperator string For example, if you have a string 'greeting' in a section 'welcomepage' you will can access it via 'L::welcomepage_greeting'. If you changed it to 'ABC' you could access your string via 'L::welcomepageABCgreeting'
$userLangs array Normally, if you use the getUserLangs-method this array will be filled in like this: 1. Forced language 2. Language in $_GET['lang'] 3. Language in $_SESSION['lang'] 4. Fallback language

공개 메소드들

메소드 설명
__construct ( $filePath = NULL, $cachePath = NULL, $fallbackLang = NULL, $prefix = NULL ) Constructor The constructor sets all important settings. All params are optional, you can set the options via extra functions too.
getAppliedLang ( )
getCachePath ( )
getFallbackLang ( )
getUserLangs ( ) : array getUserLangs() Returns the user languages Normally it returns an array like this: 1. Forced language 2. Language in $_GET['lang'] 3. Language in $_SESSION['lang'] 4. HTTP_ACCEPT_LANGUAGE 5. Fallback language Note: duplicate values are deleted.
init ( )
isInitialized ( )
setCachePath ( $cachePath )
setFallbackLang ( $fallbackLang )
setFilePath ( $filePath )
setForcedLang ( $forcedLang )
setMergeFallback ( $mergeFallback )
setPrefix ( $prefix )
setSectionSeperator ( $sectionSeperator )

보호된 메소드들

메소드 설명
compile ( $config, $prefix = '' ) Recursively compile an associative array to PHP code.
fail_after_init ( )
getConfigFilename ( $langcode )
load ( $filename )

비공개 메소드들

메소드 설명
array_extend ( $a, $b ) Something of a sane version of PHP's array_merge

메소드 상세

__construct() 공개 메소드

Constructor The constructor sets all important settings. All params are optional, you can set the options via extra functions too.
public __construct ( $filePath = NULL, $cachePath = NULL, $fallbackLang = NULL, $prefix = NULL )

compile() 보호된 메소드

Recursively compile an associative array to PHP code.
protected compile ( $config, $prefix = '' )

fail_after_init() 보호된 메소드

protected fail_after_init ( )

getAppliedLang() 공개 메소드

public getAppliedLang ( )

getCachePath() 공개 메소드

public getCachePath ( )

getConfigFilename() 보호된 메소드

protected getConfigFilename ( $langcode )

getFallbackLang() 공개 메소드

public getFallbackLang ( )

getUserLangs() 공개 메소드

getUserLangs() Returns the user languages Normally it returns an array like this: 1. Forced language 2. Language in $_GET['lang'] 3. Language in $_SESSION['lang'] 4. HTTP_ACCEPT_LANGUAGE 5. Fallback language Note: duplicate values are deleted.
public getUserLangs ( ) : array
리턴 array with the user languages sorted by priority.

init() 공개 메소드

public init ( )

isInitialized() 공개 메소드

public isInitialized ( )

load() 보호된 메소드

protected load ( $filename )

setCachePath() 공개 메소드

public setCachePath ( $cachePath )

setFallbackLang() 공개 메소드

public setFallbackLang ( $fallbackLang )

setFilePath() 공개 메소드

public setFilePath ( $filePath )

setForcedLang() 공개 메소드

public setForcedLang ( $forcedLang )

setMergeFallback() 공개 메소드

public setMergeFallback ( $mergeFallback )

setPrefix() 공개 메소드

public setPrefix ( $prefix )

setSectionSeperator() 공개 메소드

public setSectionSeperator ( $sectionSeperator )

프로퍼티 상세

$appliedLang 보호되어 있는 프로퍼티

protected $appliedLang

$cacheFilePath 보호되어 있는 프로퍼티

protected $cacheFilePath

$cachePath 보호되어 있는 프로퍼티

Cache file path This is the path for all the cache files. Best is an empty directory with no other files in it.
protected string $cachePath
리턴 string

$fallbackLang 보호되어 있는 프로퍼티

Remember to create a language file for the fallback!!
protected string $fallbackLang
리턴 string

$filePath 보호되어 있는 프로퍼티

Language file path This is the path for the language files. You must use the '{LANGUAGE}' placeholder for the language or the script wont find any language files.
protected string $filePath
리턴 string

$forcedLang 보호되어 있는 프로퍼티

Forced language If you want to force a specific language define it here.
protected string $forcedLang
리턴 string

$isInitialized 보호되어 있는 프로퍼티

protected $isInitialized

$langFilePath 보호되어 있는 프로퍼티

protected $langFilePath

$mergeFallback 보호되어 있는 프로퍼티

Merge in fallback language Whether to merge current language's strings with the strings of the fallback language ($fallbackLang).
protected bool $mergeFallback
리턴 boolean

$prefix 보호되어 있는 프로퍼티

The class name of the compiled class that contains the translated texts.
protected string $prefix
리턴 string

$sectionSeperator 보호되어 있는 프로퍼티

For example, if you have a string 'greeting' in a section 'welcomepage' you will can access it via 'L::welcomepage_greeting'. If you changed it to 'ABC' you could access your string via 'L::welcomepageABCgreeting'
protected string $sectionSeperator
리턴 string

$userLangs 보호되어 있는 프로퍼티

Normally, if you use the getUserLangs-method this array will be filled in like this: 1. Forced language 2. Language in $_GET['lang'] 3. Language in $_SESSION['lang'] 4. Fallback language
protected array $userLangs
리턴 array