2017 © Pedro Peláez
 

library locale

A simple PHP Locale Value Object

image

phospr/locale

A simple PHP Locale Value Object

  • Monday, March 14, 2016
  • by tomhv
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,073 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

Phospr\Locale

Build Status Coverage Status, (*1)

Simple PHP Locale ValueObject, (*2)

Usage

use Phospr\Locale;

echo Locale::fromString('en_US'); // en_US
echo Locale::fromCountrySlashLanguage('ca/fr'); // fr_CA

Formatting

Use:, (*3)

  • %L For uppercase language code
  • %l For lowercase language code
  • %C For uppercase country code
  • %c For lowercase country code

Note:, (*4)

  • any other combination of %{:char:} will throw an InvalidArgumentException unless the % is escaped with \
  • to get a \ You will need to double escape ( \\\ )

Examples:, (*5)

echo Locale::fromString('se_FI')->format('%L_%c'); // SE_fi
echo Locale::fromString('se_FI')->format('%C/%s'); // FI/se
echo Locale::fromString('se_FI')->format('%c/%s'); // fi/se
echo Locale::fromString('se_FI')->format('%c\\\%s'); // fi\se

Installation

composer require phospr/locale

Sources

Language data from http://stackoverflow.com/a/4900304, (*6)

Country data from http://country.io/data/, (*7)

The Versions

14/03 2016

dev-master

9999999-dev

A simple PHP Locale Value Object

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Tom Haskins-Vaughan

14/03 2016

v1.0.0

1.0.0.0

A simple PHP Locale Value Object

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Tom Haskins-Vaughan