sokil / php-language
Engine to work with language preferences on site
dev-master
2016-09-05 06:18 UTC
This package is auto-updated.
Last update: 2024-10-28 01:45:05 UTC
README
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.
Prefered language goes from cookies, or if not specified - from browser. If language not listed in preffered - use default value.
Example of usage:
// 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');