Skip to content

Commit

Permalink
Renamed ProviderStackTrait as ProviderChainTrait.
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Jan 19, 2015
1 parent 343be11 commit 95204ae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

The __CLDR__ package provides means to internationalize your application by leveraging the
data and conventions defined by the [Unicode Common Locale Data Repository](http://cldr.unicode.org/) (CLDR).
It provides many useful locale information and data (such as locale names for territories,
languages, days…) as well as many formatters for numbers, currencies, date amd times, lists…

The package targets the [CLDR version 26](http://cldr.unicode.org/index/downloads/cldr-26), from
which data is retrieved when required.
Expand All @@ -14,9 +16,9 @@ which data is retrieved when required.

The CLDR is represented by a [Repository][] instance, from which data is accessed. When required,
data is retrieved through a provider, and in order to avoid hitting the web with every request,
a stack of them is used, each with its own caching strategies.
a chain of providers is used, each with its own caching strategies.

The following example demonstrates how a repository can be instantiated with a nice stack of
The following example demonstrates how a repository can be instantiated with a nice chain of
providers. One fetches the data from the web, the other from the filesystem, and the last one
from the runtime memory:

Expand Down Expand Up @@ -387,7 +389,7 @@ $euro = $repository->currencies['EUR'];
### Localized currencies

A localized currency can be obtained with the `localize()` method, or the `localize()` method
of the desired locale.
of the desired locale, it is often used to format a currency using the convention of a locale.

```php
<php
Expand All @@ -403,7 +405,7 @@ $localized_currency = $repository->locale['fr']->localize($currency);
echo $localized_currency->name; // euro
echo $localized_currency->name(1); // euro
echo $localized_currency->name(10); // euros
echo $localized_currency->format(12345.67); // 1 2345,67 €
echo $localized_currency->format(12345.67); // 12 345,67 €
```


Expand Down Expand Up @@ -461,7 +463,7 @@ $formatter = new ListFormatter($repository);

$localized_formatter = $formatter->localize('fr');
# or
$localized_formatter = $repository->locales['fr']->format($formatter);
$localized_formatter = $repository->locales['fr']->localize($formatter);
# or
$localized_formatter = new LocalizedListFormatter($formatter, $repository->locales['fr']);

Expand Down
2 changes: 1 addition & 1 deletion lib/FileProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
class FileProvider implements ProviderInterface, CacheInterface
{
use ProviderStackTrait;
use ProviderChainTrait;

/**
* Create a store key from a CLDR path.
Expand Down
4 changes: 2 additions & 2 deletions lib/ProviderStackTrait.php → lib/ProviderChainTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace ICanBoogie\CLDR;

/**
* A trait for stackable providers which also implement {@link CacheInterface}.
* A trait for chained providers which also implement {@link CacheInterface}.
*
* @package ICanBoogie\CLDR
*/
trait ProviderStackTrait
trait ProviderChainTrait
{
/**
* @var ProviderInterface
Expand Down
2 changes: 1 addition & 1 deletion lib/RunTimeProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
class RunTimeProvider implements ProviderInterface, CacheInterface
{
use ProviderStackTrait;
use ProviderChainTrait;

private $store = [];

Expand Down

0 comments on commit 95204ae

Please sign in to comment.