PHP 클래스 Neos\Flow\I18n\Utility

파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

공개 메소드들

메소드 설명
extractLocaleTagFromFilename ( string $filename ) : mixed Extracts a locale tag (identifier) from the filename given.
parseAcceptLanguageHeader ( string $acceptLanguageHeader ) : mixed Parses Accept-Language header and returns array of locale tags (like: en-GB, en), or FALSE if no tags were found.
stringBeginsWith ( string $haystack, string $needle ) : boolean Checks if $haystack string begins with $needle string.
stringEndsWith ( string $haystack, string $needle ) : boolean Checks if $haystack string ends with $needle string.

메소드 상세

extractLocaleTagFromFilename() 공개 정적인 메소드

Locale tag should be placed just before the extension of the file. For example, filename bar.png can be localized as bar.en_GB.png, and this method extracts en_GB from the name. Note: this ignores matches on rss, xml and php and validates the identifier.
public static extractLocaleTagFromFilename ( string $filename ) : mixed
$filename string Filename to extract locale identifier from
리턴 mixed The string with extracted locale identifier of FALSE on failure

parseAcceptLanguageHeader() 공개 정적인 메소드

This method only returns tags that conforms ISO 639 for language codes and ISO 3166 for region codes. HTTP spec (RFC 2616) defines both of these parts as 1*8ALPHA, but this method ignores tags with longer (or shorter) codes than defined in ISO mentioned above. There can be an asterisk "*" in the returned array, which means that any language is acceptable. Warning: This method expects that locale tags are placed in descending order by quality in the $header string. I'm not sure if it's always true with the web browsers.
public static parseAcceptLanguageHeader ( string $acceptLanguageHeader ) : mixed
$acceptLanguageHeader string
리턴 mixed The array of locale identifiers or FALSE

stringBeginsWith() 공개 정적인 메소드

Checks if $haystack string begins with $needle string.
public static stringBeginsWith ( string $haystack, string $needle ) : boolean
$haystack string
$needle string
리턴 boolean TRUE if $haystack begins with $needle

stringEndsWith() 공개 정적인 메소드

Checks if $haystack string ends with $needle string.
public static stringEndsWith ( string $haystack, string $needle ) : boolean
$haystack string
$needle string
리턴 boolean TRUE if $haystack ends with $needle