PHP Class Xpressengine\Translation\Translator

Author: XE Team (developers) ([email protected])
Inheritance: extends NamespacedItemResolver, implements Symfony\Component\Translation\TranslatorInterface
Show file Open project: xpressengine/xpressengine Class Usage Examples

Protected Properties

Property Type Description
$cachedDb
$fileLoader
$keyGen
$locales
$preprocessorProtocol
$texts
$urlLoader
$userKeyPrefix

Public Methods

Method Description
__construct ( array $config, Keygen $keyGen, TransCachedDatabase $cachedDb, Xpressengine\Translation\Loaders\LoaderInterface $fileLoader, Xpressengine\Translation\Loaders\LoaderInterface $urlLoader )
choice ( string $key, integer $number, array $replace = [], null $locale = null ) : mixed
genUserKey ( ) : string 사용자 정의 다국어로 사용될 수 있는 키를 생성합니다
get ( string $key, array $replace = [], null $locale = null ) : mixed 다국어로 번역되기 전 원형 문장을 읽어옵니다
getLocale ( ) : string 현재 선택 로케일을 리턴
getLocaleText ( string $locale ) : string 로케일에 해당하는 문자열 반환
getLocales ( ) : array 로케일 목록의 배열을 리턴
getOriginalLine ( string $key ) : mixed
getPreprocessorValues ( array $inputs, string $sessionLocale = null ) : array LangPreprocessor 로 만들어진 다국어 정보에서 현재 설정에서 사용해야할 값들을 리턴합니다.
getSelector ( ) : Symfony\Component\Translation\MessageSelector 메세지 선택을 위한 셀렉터를 얻습니다
parsePreprocessor ( string $key ) : array | null 미들웨어에서 생성된 다국어 참조 키를 분해하여 리턴합니다
putFromLangDataSource ( string $namespace, string $source, string $type = 'file' ) : void 외부의 다국어 파일을 주어진 네임스페이스로 저장합니다
save ( string $key, string $locale, string $value, boolean $multiLine = false ) : void 다국어 라인을 저장합니다
setCurrentCacheKey ( string $key ) : void 단위당 다국어 캐시를 그룹화 하기 위한 캐시 키를 지정
setLocale ( string $locale ) : void 현재 로케일을 선택
setLocaleTexts ( array $texts ) : void 로케일 표현 문자열 등록
setLocales ( array $locales ) : void 로케일 목록을 입력
trans ( string $id, array $parameters = [], null $domain = null, null $locale = null ) : mixed 다국어를 번역합니다
transChoice ( string $id, integer $number, array $parameters = [], null $domain = null, null $locale = null ) : mixed 선택이 가능한 다국어를 번역합니다

Protected Methods

Method Description
getLine ( string $namespace, string $item, string $locale, array $replace ) : mixed
makeReplacements ( string $line, array $replace ) : mixed 인자를 넘겨 번역할 수 있는 다국어 라인을 번역합니다
makeUnknownSentence ( string $id ) : string 언어가 없는 키가 표현될 문자를 생성합니다
parseLocale ( string $locale ) : array 주어진 로케일을 기반으로 fallback 처리를 위한 locales 목록을 리턴합니다
sortReplacements ( array $replace ) : array 인자를 넘겨 번역할 수 있는 다국어 처리 중 인자 이름이 더 긴 순으로 정렬합니다.

Method Details

__construct() public method

public __construct ( array $config, Keygen $keyGen, TransCachedDatabase $cachedDb, Xpressengine\Translation\Loaders\LoaderInterface $fileLoader, Xpressengine\Translation\Loaders\LoaderInterface $urlLoader )
$config array 설정
$keyGen Xpressengine\Keygen\Keygen 사용자 정의 다국어용 키 생성기
$cachedDb TransCachedDatabase 다국어 캐시 디비
$fileLoader Xpressengine\Translation\Loaders\LoaderInterface 다국어 파일 로더
$urlLoader Xpressengine\Translation\Loaders\LoaderInterface 다국어 URL 로더

choice() public method

public choice ( string $key, integer $number, array $replace = [], null $locale = null ) : mixed
$key string 다국어 key
$number integer 숫자
$replace array 변경 데이터
$locale null 로케일
return mixed

genUserKey() public method

사용자 정의 다국어로 사용될 수 있는 키를 생성합니다
public genUserKey ( ) : string
return string

get() public method

다국어로 번역되기 전 원형 문장을 읽어옵니다
public get ( string $key, array $replace = [], null $locale = null ) : mixed
$key string 다국어 key
$replace array 변경 데이터
$locale null 로케일
return mixed

getLine() protected method

protected getLine ( string $namespace, string $item, string $locale, array $replace ) : mixed
$namespace string Namespace
$item string 아이템
$locale string 로케일
$replace array 변경 데이터
return mixed

getLocale() public method

현재 선택 로케일을 리턴
public getLocale ( ) : string
return string

getLocaleText() public method

로케일에 해당하는 문자열 반환
public getLocaleText ( string $locale ) : string
$locale string 선택 로케일
return string

getLocales() public method

로케일 목록의 배열을 리턴
public getLocales ( ) : array
return array

getOriginalLine() public method

public getOriginalLine ( string $key ) : mixed
$key string 다국어 key
return mixed

getPreprocessorValues() public method

LangPreprocessor 로 만들어진 다국어 정보에서 현재 설정에서 사용해야할 값들을 리턴합니다.
public getPreprocessorValues ( array $inputs, string $sessionLocale = null ) : array
$inputs array inputs
$sessionLocale string 세션 로케일 정보
return array

getSelector() public method

메세지 선택을 위한 셀렉터를 얻습니다
public getSelector ( ) : Symfony\Component\Translation\MessageSelector
return Symfony\Component\Translation\MessageSelector

makeReplacements() protected method

인자를 넘겨 번역할 수 있는 다국어 라인을 번역합니다
protected makeReplacements ( string $line, array $replace ) : mixed
$line string 원시 라인
$replace array 변경 데이터
return mixed

makeUnknownSentence() protected method

언어가 없는 키가 표현될 문자를 생성합니다
protected makeUnknownSentence ( string $id ) : string
$id string 다국어 key
return string

parseLocale() protected method

주어진 로케일을 기반으로 fallback 처리를 위한 locales 목록을 리턴합니다
protected parseLocale ( string $locale ) : array
$locale string 선택 로케일
return array

parsePreprocessor() public method

미들웨어에서 생성된 다국어 참조 키를 분해하여 리턴합니다
See also: App\Http\Middleware\LangPreprocessor
public parsePreprocessor ( string $key ) : array | null
$key string LangPreprocessor 에서 생성한 키
return array | null

putFromLangDataSource() public method

외부의 다국어 파일을 주어진 네임스페이스로 저장합니다
public putFromLangDataSource ( string $namespace, string $source, string $type = 'file' ) : void
$namespace string Namespace
$source string 소스
$type string 로더 타입
return void

save() public method

캐시된 데이터 갱신을 위해 다국어 캐시를 비웁니다
public save ( string $key, string $locale, string $value, boolean $multiLine = false ) : void
$key string 다국어 키
$locale string 로케일
$value string 번역문
$multiLine boolean 멀티라인 지원 여부
return void

setCurrentCacheKey() public method

단위당 다국어 캐시(예를 들어, 한 웹 페이지)를 구룹화 하기 위한 캐시키를 지정.
public setCurrentCacheKey ( string $key ) : void
$key string 설정 키
return void

setLocale() public method

존재하지 않는 로케일을 선택할 수 없습니다.
public setLocale ( string $locale ) : void
$locale string 선택 로케일
return void

setLocaleTexts() public method

로케일 표현 문자열 등록
public setLocaleTexts ( array $texts ) : void
$texts array 로케일 문자열 배열
return void

setLocales() public method

이미 존재하는 로케일이 발견되면 나중의 것을 필터링 합니다.
public setLocales ( array $locales ) : void
$locales array 로케일 배열
return void

sortReplacements() protected method

정렬을 통해 앞 부분이 같은 인자 중 좀 더 긴 글자로 매칭되는 인자를 먼저 해석하여 정확도를 높여줍니다.
protected sortReplacements ( array $replace ) : array
$replace array 변경 데이터
return array

trans() public method

다국어를 번역합니다
public trans ( string $id, array $parameters = [], null $domain = null, null $locale = null ) : mixed
$id string 다국어 key
$parameters array 인자
$domain null domain
$locale null locale
return mixed

transChoice() public method

선택이 가능한 다국어를 번역합니다
public transChoice ( string $id, integer $number, array $parameters = [], null $domain = null, null $locale = null ) : mixed
$id string 다국어 key
$number integer 숫자
$parameters array 인자
$domain null domain
$locale null locale
return mixed

Property Details

$cachedDb protected property

protected $cachedDb

$fileLoader protected property

protected $fileLoader

$keyGen protected property

protected $keyGen

$locales protected property

protected $locales

$preprocessorProtocol protected property

protected $preprocessorProtocol

$texts protected property

protected $texts

$urlLoader protected property

protected $urlLoader

$userKeyPrefix protected property

protected $userKeyPrefix