unreal4u/localization

This package is abandoned and no longer maintained. No replacement package was suggested.

This class sets almost all locale settings and makes your life easier by doing so

v0.4.2 2017-01-03 08:47 UTC

This package is auto-updated.

Last update: 2024-07-02 13:48:05 UTC


README

Latest Stable Version Build Status Scrutinizer Code Quality License

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