PHPackages                             macroactive/cldr - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. macroactive/cldr

ActiveLibrary[Localization &amp; i18n](/categories/localization)

macroactive/cldr
================

A lightweight localization database and translation tools, with data from the CLDR, IANA, ISO, etc.

v2.4.1(3y ago)057GPL-3.0-or-laterPHPPHP &gt;=8.1.0

Since Oct 19Pushed 3y agoCompare

[ Source](https://github.com/macroactive-io/cldr)[ Packagist](https://packagist.org/packages/macroactive/cldr)[ Docs](https://github.com/macroactive-io/cldr)[ RSS](/packages/macroactive-cldr/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (10)Versions (9)Used By (0)

This package represents stripped reference data cloned from AWESOME [fisharebest/localization](https://github.com/fisharebest/localization). Main difference:

- removed `Translator`
- PHP version &gt;= 8.1 for the sake of using strict typing, enums, etc
- obviously, changed NS and package name

Localization standards and data
===============================

[](#localization-standards-and-data)

This package combines localization data from many standards, including the [Unicode CLDR](http://cldr.unicode.org), [RFC5646 / IANA subtag registry](https://tools.ietf.org/html/rfc5646), [ISO-3166](https://en.wikipedia.org/wiki/ISO_3166), [ISO-639](https://en.wikipedia.org/wiki/ISO_639), [ISO-15924](http://unicode.org/iso15924/), etc., to help you produce applications that behave nicely for visitors from around the world.

Includes definitions for over 800 locales.

Locales, languages, scripts and territories
===========================================

[](#locales-languages-scripts-and-territories)

A locale consists of three things: a language, a script and a territory. Scripts and territories are often implicit from the language.

Normally you would just need to work with locales, and can ignore languages and scripts.

```
$locale = new LocaleJa;         // Create a locale for Japanese.
$locale = Locale::create('ja'); // Create a locale for Japanese, from its code.

$locale->code();                // "ja_JP" (territories are always included in locale codes)
$locale->languageTag();         // "ja" (redundant territories are omitted in tags)
$locale->endonym();             // "日本語" (Japanese name for Japanese)

// Languages - extract from the locale, or create with "new LanguageXx"
$locale->language();            // LanguageJa
$locale->language()->code();    // "ja" (ISO-639 code)

// Scripts - extract from the locale, or create with "new ScriptXxxx"
$locale->script();              // ScriptJpan
$locale->script()->code();      // "Jpan" (ISO-15924 code)
$locale->script()->direction(); // "ltr" (left to right)

// Territories - extract from the locale, or create with "new TerritoryXx"
$locale->territory();           // TerritoryJp
$locale->territory()->code();   // "JP" (ISO-3166 code)

// A few locales can also specify variants.
$locale = new LocaleCaValencia; // The Valencian dialect of Catalan
$locale->variant();             // VariantValencia
$locale->variant()->code();     // "valencia"
```

Localization
============

[](#localization)

Create a locale and use it to localize data in your application.

```
// Many ways to create locales
$locale = new LocaleEnGb;
$locale = Locale::create('en-GB'); // Use upper/lower case, hyphens/underscores/@
$locale = Locale::httpAcceptLanguage($_SERVER, $available_locales, $default_locale);

// Markup for HTML elements containing this locale
$locale->htmlAttributes();      // lang="ar" dir="rtl"

// Is text written left-to-right or right-to-left
$locale->direction();           // "ltr" or "rtl"

// Days of the week.
$locale->firstDay();            // 0=Sunday, 1=Monday, etc.
$locale->weekendStart();        // 0=Sunday, 1=Monday, etc.
$locale->weekendEnd();          // 0=Sunday, 1=Monday, etc.

// Measurement systems and paper sizes.
$locale->measurementSystem();   // "metric", "UK" or "US"
$locale->paperSize();           // "A4" or "US-Letter"

// Formatting numbers
$locale = new LocaleGr;         // Gujarati
$locale->digits('2014');        // "૨૦૧૪"
$locale = new LocaleItCh;       // Swiss Italian
$locale->number('12345678.9');  // "12'345'678.9"
$locale->percent(0.123);        // "12.3%"

// To sort data properly in MySQL, you need to specify a collation sequence.
// See http://dev.mysql.com/doc/refman/5.7/en/charset-unicode-sets.html
$locale->collation();           // "unicode_ci", "swedish_ci", etc.
```

Plural rules
============

[](#plural-rules)

Plural rules are defined for each locale. This example shows that although English and French both have two plural forms, English considers zero as plural, while french considers it to be singular.

```
$locale = new LocaleEn;
$locale->pluralRule()->plurals(); // 2 (English has two plural forms)
$locale->pluralRule()->plural(0); // 1 (zero is plural in English "zero apples")
$locale = new LocaleFr;
$locale->pluralRule()->plurals(); // 2 (French also has two plural forms)
$locale->pluralRule()->plural(0); // 0 (zero is singular in French "zero apple")
```

Updates welcome
===============

[](#updates-welcome)

Please provide references to sources, such as:

- [Unicode CLDR](https://cldr.unicode.org/)
- [Ethnologue](https://www.ethnologue.com)
- [ScriptSource](https://www.scriptsource.org)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 63.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~9 days

Recently: every ~3 days

Total

8

Last Release

1240d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7dc66e4d5a2c28386f6c96323362fe391b4cbcbf69919573d4a08f5b3ce17c7?d=identicon)[SCIF](/maintainers/SCIF)

---

Top Contributors

[![fisharebest](https://avatars.githubusercontent.com/u/2306088?v=4)](https://github.com/fisharebest "fisharebest (58 commits)")[![SCIF](https://avatars.githubusercontent.com/u/671925?v=4)](https://github.com/SCIF "SCIF (31 commits)")[![adawolfa](https://avatars.githubusercontent.com/u/92433271?v=4)](https://github.com/adawolfa "adawolfa (1 commits)")[![ungeahnt](https://avatars.githubusercontent.com/u/28572767?v=4)](https://github.com/ungeahnt "ungeahnt (1 commits)")

---

Tags

localizationi18nlanguagel10ntranslatecldrtranslationlocalescript

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/macroactive-cldr/health.svg)

```
[![Health](https://phpackages.com/badges/macroactive-cldr/health.svg)](https://phpackages.com/packages/macroactive-cldr)
```

###  Alternatives

[fisharebest/localization

A lightweight localization database and translation tools, with data from the CLDR, IANA, ISO, etc.

3191.1k2](/packages/fisharebest-localization)[gettext/languages

gettext languages with plural rules

7530.3M11](/packages/gettext-languages)[aplus/language

Aplus Framework Language Library

2351.7M15](/packages/aplus-language)[punic/punic

PHP-Unicode CLDR

1542.9M29](/packages/punic-punic)[tractorcow/silverstripe-fluent

Simple localisation for Silverstripe

92421.6k26](/packages/tractorcow-silverstripe-fluent)[delight-im/i18n

Internationalization and localization for PHP

625.2k3](/packages/delight-im-i18n)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
