PHP 클래스 yii\i18n\GettextMessageSource

Each GettextMessageSource instance represents the message translations for a single domain. And each message category represents a message context in Gettext. Translated messages are stored as either a MO or PO file, depending on the [[useMoFile]] property value. All translations are saved under the [[basePath]] directory. Translations in one language are kept as MO or PO files under an individual subdirectory whose name is the language ID. The file name is specified via [[catalog]] property, which defaults to 'messages'.
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends MessageSource
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$basePath string
$catalog string
$useBigEndian boolean
$useMoFile boolean

보호된 메소드들

메소드 설명
getMessageFilePath ( string $language ) : string Returns message file path for the specified language and category.
loadFallbackMessages ( string $category, string $fallbackLanguage, array $messages, string $originalMessageFile ) : array The method is normally called by [[loadMessages]] to load the fallback messages for the language.
loadMessages ( string $category, string $language ) : array Loads the message translation for the specified $language and $category.
loadMessagesFromFile ( string $messageFile, string $category ) : array | null Loads the message translation for the specified language and category or returns null if file doesn't exist.

메소드 상세

getMessageFilePath() 보호된 메소드

Returns message file path for the specified language and category.
protected getMessageFilePath ( string $language ) : string
$language string the target language
리턴 string path to message file

loadFallbackMessages() 보호된 메소드

Method tries to load the $category messages for the $fallbackLanguage and adds them to the $messages array.
부터: 2.0.7
protected loadFallbackMessages ( string $category, string $fallbackLanguage, array $messages, string $originalMessageFile ) : array
$category string the message category
$fallbackLanguage string the target fallback language
$messages array the array of previously loaded translation messages. The keys are original messages, and the values are the translated messages.
$originalMessageFile string the path to the file with messages. Used to log an error message in case when no translations were found.
리턴 array the loaded messages. The keys are original messages, and the values are the translated messages.

loadMessages() 보호된 메소드

If translation for specific locale code such as en-US isn't found it tries more generic en. When both are present, the en-US messages will be merged over en. See [[loadFallbackMessages]] for details. If the $language is less specific than [[sourceLanguage]], the method will try to load the messages for [[sourceLanguage]]. For example: [[sourceLanguage]] is en-GB, $language is en. The method will load the messages for en and merge them over en-GB.
또한 보기: loadFallbackMessages
또한 보기: sourceLanguage
protected loadMessages ( string $category, string $language ) : array
$category string the message category
$language string the target language
리턴 array the loaded messages. The keys are original messages, and the values are translated messages.

loadMessagesFromFile() 보호된 메소드

Loads the message translation for the specified language and category or returns null if file doesn't exist.
protected loadMessagesFromFile ( string $messageFile, string $category ) : array | null
$messageFile string path to message file
$category string the message category
리턴 array | null array of messages or null if file not found

프로퍼티 상세

$basePath 공개적으로 프로퍼티

public string $basePath
리턴 string

$catalog 공개적으로 프로퍼티

public string $catalog
리턴 string

$useBigEndian 공개적으로 프로퍼티

public bool $useBigEndian
리턴 boolean

$useMoFile 공개적으로 프로퍼티

public bool $useMoFile
리턴 boolean