PHP 클래스 Yasumi\Translations

상속: implements yasumi\TranslationsInterface
파일 보기 프로젝트 열기: azuyalabs/yasumi 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$translations translations array: ['' => ['' => 'translation', ...], ... ]

공개 메소드들

메소드 설명
__construct ( array $availableLocales ) Constructor.
addTranslation ( string $shortName, string $locale, string $translation ) Adds translation for holiday in specific locale.
getTranslation ( string $shortName, string $locale ) : string | null Returns translation for holiday in specific locale.
getTranslations ( string $shortName ) : array Returns all available translations for holiday.
loadTranslations ( string $directoryPath ) Loads translations from directory.

보호된 메소드들

메소드 설명
isValidLocale ( string $locale ) : true Checks whether the given locale is a valid/available locale.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( array $availableLocales )
$availableLocales array list of all defined locales

addTranslation() 공개 메소드

Adds translation for holiday in specific locale.
public addTranslation ( string $shortName, string $locale, string $translation )
$shortName string holiday short name
$locale string locale
$translation string translation

getTranslation() 공개 메소드

Returns translation for holiday in specific locale.
public getTranslation ( string $shortName, string $locale ) : string | null
$shortName string holiday short name
$locale string locale
리턴 string | null translated holiday name

getTranslations() 공개 메소드

Returns all available translations for holiday.
public getTranslations ( string $shortName ) : array
$shortName string holiday short name
리턴 array holiday name translations ['' => '', ...]

isValidLocale() 보호된 메소드

Checks whether the given locale is a valid/available locale.
protected isValidLocale ( string $locale ) : true
$locale string locale the locale to be validated
리턴 true upon success, otherwise an UnknownLocaleException is thrown

loadTranslations() 공개 메소드

Loads translations from directory.
public loadTranslations ( string $directoryPath )
$directoryPath string directory path for translation files

프로퍼티 상세

$translations 공개적으로 프로퍼티

translations array: ['' => ['' => 'translation', ...], ... ]
public $translations