2017 © Pedro Peláez
 

library locale

The Hoa\Locale library.

image

hoa/locale

The Hoa\Locale library.

  • Tuesday, January 23, 2018
  • by Hoa
  • Repository
  • 11 Watchers
  • 11 Stars
  • 2,585 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 15 Versions
  • 11 % Grown

The README.md

Hoa , (*1)


Build status Code coverage Packagist License , (*2)

Hoa is a modular, extensible and structured set of PHP libraries.
Moreover, Hoa aims at being a bridge between industrial and research worlds. , (*3)

Hoa\Locale

Help on IRC Help on Gitter Documentation Board, (*4)

This library allows to get the informations of the locale from the system, the HTTP client or something else., (*5)

Learn more., (*6)

Installation

With Composer, to include this library into your dependencies, you need to require hoa/locale:, (*7)

$ composer require hoa/locale '~2.0'

For more installation procedures, please read the Source page., (*8)

Testing

Before running the test suites, the development dependencies must be installed:, (*9)

$ composer install

Then, to run all the test suites:, (*10)

$ vendor/bin/hoa test:run

For more information, please read the contributor guide., (*11)

Quick usage

We propose a quick overview to get the locale and related informations about an HTTP client. Next, we will see the other localizers., (*12)

Locale from an HTTP client

To get the locale from an HTTP client, we will use the Hoa\Locale\Localizer\Http localizer. Then, we will print the result of the following interesting methods:, (*13)

  • getLanguage to get the language,
  • getScript to get the script,
  • getRegion to get the region,
  • getVariants to get variants of the locale.

Thus:, (*14)

$locale = new Hoa\Locale(new Hoa\Locale\Localizer\Http());

echo
    'language : ', $locale->getLanguage(), "\n",
    'script   : ', $locale->getScript(), "\n",
    'region   : ', $locale->getRegion(), "\n",
    'variant  : ', implode(', ', $locale->getVariants()), "\n";

For example, with the Accept-Language HTTP header set to zh-Hant-TW-xy-ab-123, we will have:, (*15)

language : zh
script   : Hant
region   : TW
variant  : xy, ab, 123

Other localizers

So far, we also have the Hoa\Locale\Localizer\System to get the locale informations from the system and Hoa\Locale\Localizer\Coerce to get them from an arbitrary locale representation., (*16)

Documentation

The hack book of Hoa\Locale contains detailed information about how to use this library and how it works., (*17)

To generate the documentation locally, execute the following commands:, (*18)

$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open

More documentation can be found on the project's website: hoa-project.net., (*19)

Getting help

There are mainly two ways to get help:, (*20)

Contribution

Do you want to contribute? Thanks! A detailed contributor guide explains everything you need to know., (*21)

License

Hoa is under the New BSD License (BSD-3-Clause). Please, see LICENSE for details., (*22)

The Versions

23/01 2018

dev-master

9999999-dev https://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

10/01 2017

2.17.01.10

2.17.01.10 https://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

19/11 2016

2.16.11.19

2.16.11.19 https://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

14/01 2016

2.16.01.14

2.16.01.14 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

11/01 2016

2.16.01.11

2.16.01.11 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

08/09 2015

1.15.09.08

1.15.09.08 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

29/05 2015

1.15.05.29

1.15.05.29 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

23/02 2015

1.15.02.23

1.15.02.23 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

09/12 2014

1.14.12.10

1.14.12.10 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

25/11 2014

1.14.11.26

1.14.11.26 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

15/11 2014

1.14.11.17

1.14.11.17 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

15/11 2014

0.14.11.15

0.14.11.15 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

language library http locale l10n rfc2822 setlocale rfc4646 rfc3282

23/09 2014

0.14.09.23

0.14.09.23 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

language library http locale l10n setlocale

17/09 2014

0.14.09.17

0.14.09.17 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

language library http locale l10n setlocale

16/09 2014

0.14.09.16

0.14.09.16 http://hoa-project.net/

The Hoa\Locale library.

  Sources   Download

BSD-3-Clause

The Requires

 

language library http locale l10n setlocale