library php-language
Engine to work with language preferences on site
sokil/php-language
Engine to work with language preferences on site
- Monday, September 5, 2016
- by sokil
- Repository
- 1 Watchers
- 0 Stars
- 20 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
php-language
Library to work with languages and localization on site. This library able to get prefered language from browser settings and store chosen option to cookie., (*1)
Prefered language goes from cookies, or if not specified - from browser. If language not listed in preffered - use default value., (*2)
Example of usage:, (*3)
// define supported languages
$language = new \Sokil\Language([
'uk' => ['caption' => 'Ukraininan', 'locale' => 'uk_UA.UTF-8'],
'en' => ['caption' => 'English', 'locale' => 'en_UK.UTF-8'],
], 'uk');
echo $language->getLanguage();
// if language chosed from list and must be set as system with writing to cookie
$language->setLanguage('uk');
dev-master
9999999-dev
Engine to work with language preferences on site
Sources
Download
MIT
by
sokil