unreal4u / localization
This class sets almost all locale settings and makes your life easier by doing so
v0.4.2
2017-01-03 08:47 UTC
Requires
- php: >=5.3.0
- ext-intl: *
Requires (Dev)
- phpunit/php-code-coverage: @stable
- phpunit/phpunit: @stable
- unreal4u/debug-info: dev-master
This package is auto-updated.
Last update: 2024-03-26 08:17:45 UTC
README
localization.class.php
Credits
This class is made by unreal4u (Camilo Sperberg). http://unreal4u.com/.
About this class
- This class will interact with the server to set locale settings
- It is able to autodetect from the browser which locale you can setup
- You can also set it to whatever locale you want
- It will also format numbers and currencies for you
- It will also format dates and times
- It also is able to work with timezones
Basic usage
include('src/unreal4u/localization.class.php'); $locale = new unreal4u\localization(); $locale->autodetectLocale(); $locale->formatNumber(3.1415);
- Congratulations! You have just printed 3.1415 formatted according to your browser locale settings!
- Please see documentation folder for more options and advanced usage
Composer
This class has support for Composer install. Just add the following section to your composer.json with:
{ "require": { "unreal4u/localization": "0.3.*@dev" } }
Now you can instantiate a new localization class by executing:
require('vendor/autoload.php'); $localization = new unreal4u\localization();
TODO list
- Pass PHP_CodeSniffer
- Implement more tests
- Print percentage
- Print other stuff, make it easy to do so
Version History
- 0.1 :
- Original class
- 0.3 :
- Composer and PSR-0 compatibility
- 0.4.0:
- Deleted check for inline PHP >= 5.3
- Class is now tested with Travis-CI
- Updated PHPUnit to v4.0
- Deleted method formatSimpleNumber and formatSimpleCurrency in favor of formatNumber
Contact the author
- Twitter: @unreal4u
- Website: http://unreal4u.com/
- Github: http://www.github.com/unreal4u