PHP 클래스 Pop\I18n\I18n

저자: Nick Sagona, III ([email protected])
파일 보기 프로젝트 열기: nicksagona/PopPHP 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$content array Language content
$language string Default system language
$locale string Default system locale

공개 메소드들

메소드 설명
__ ( string $str, string | array $params = null ) Return the translated string
__construct ( string $lang = null ) : I18n Constructor
_e ( string $str, string | array $params = null ) : void Echo the translated string.
createXmlFile ( array $lang, array $locales, string $file ) : void Create an XML language file from an array of data.
createXmlFromText ( string $source, string $output, string $target = null ) : void Create an XML document fragment from a source file and an output file, each entry separated by a new line
factory ( string $lang = null ) : I18n Static method to load the I18n object.
getLanguage ( ) : string Get current language setting.
getLanguages ( string $dir = null ) : array Get languages from the XML files.
getLocale ( ) : string Get current locale setting.
loadFile ( string $langFile ) : void Load language content from an XML file.

보호된 메소드들

메소드 설명
loadCurrentLanguage ( ) : void Get language content from the XML file.
translate ( string $str, string | array $params = null ) : mixed Translate and return the string.

메소드 상세

__() 공개 메소드

Return the translated string
public __ ( string $str, string | array $params = null )
$str string
$params string | array

__construct() 공개 메소드

Instantiate the I18n object.
public __construct ( string $lang = null ) : I18n
$lang string
리턴 I18n

_e() 공개 메소드

Echo the translated string.
public _e ( string $str, string | array $params = null ) : void
$str string
$params string | array
리턴 void

createXmlFile() 공개 정적인 메소드

The format of the parameters should be as follows: $lang = array( 'src' => 'en', 'output' => 'de', 'name' => 'German', 'native' => 'Deutsch' ); $locales = array( array( 'region' => 'DE', 'name' => 'Germany', 'native' => 'Deutschland', 'text' => array( array( 'source' => 'This field is required.', 'output' => 'Dieses Feld ist erforderlich.' ), ... ) ), ... );
public static createXmlFile ( array $lang, array $locales, string $file ) : void
$lang array
$locales array
$file string
리턴 void

createXmlFromText() 공개 정적인 메소드

Create an XML document fragment from a source file and an output file, each entry separated by a new line
public static createXmlFromText ( string $source, string $output, string $target = null ) : void
$source string
$output string
$target string
리턴 void

factory() 공개 정적인 메소드

Static method to load the I18n object.
public static factory ( string $lang = null ) : I18n
$lang string
리턴 I18n

getLanguage() 공개 메소드

Get current language setting.
public getLanguage ( ) : string
리턴 string

getLanguages() 공개 정적인 메소드

Get languages from the XML files.
public static getLanguages ( string $dir = null ) : array
$dir string
리턴 array

getLocale() 공개 메소드

Get current locale setting.
public getLocale ( ) : string
리턴 string

loadCurrentLanguage() 보호된 메소드

Get language content from the XML file.
protected loadCurrentLanguage ( ) : void
리턴 void

loadFile() 공개 메소드

Load language content from an XML file.
public loadFile ( string $langFile ) : void
$langFile string
리턴 void

translate() 보호된 메소드

Translate and return the string.
protected translate ( string $str, string | array $params = null ) : mixed
$str string
$params string | array
리턴 mixed

프로퍼티 상세

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

Language content
protected array $content
리턴 array

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

Default system language
protected string $language
리턴 string

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

Default system locale
protected string $locale
리턴 string