PHP Класс Neos\Flow\I18n\Utility

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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