PHPackages                             locomotivemtl/charcoal-translation - 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. locomotivemtl/charcoal-translation

Abandoned → [locomotivemtl/charcoal-translator](/?search=locomotivemtl%2Fcharcoal-translator)ArchivedLibrary[Localization &amp; i18n](/categories/localization)

locomotivemtl/charcoal-translation
==================================

Charcoal Translations &amp; Languages

0.1(9y ago)06.0kMITPHPPHP &gt;=5.6.0

Since Oct 12Pushed 9y ago9 watchersCompare

[ Source](https://github.com/locomotivemtl/charcoal-translation)[ Packagist](https://packagist.org/packages/locomotivemtl/charcoal-translation)[ Docs](https://charcoal.locomotive.ca)[ RSS](/packages/locomotivemtl-charcoal-translation/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (9)Versions (4)Used By (0)

Charcoal Translation
====================

[](#charcoal-translation)

Charcoal provides a comprehensive solution for handling localisation, internationalization, and translation for a multi-lingual Charcoal project.

Usage
-----

[](#usage)

Setting the default language / setting the current language:

```
use \Charcoal\Translation\TranslationConfig;

$translation_config = TranslationConfig::instance();

// Set the list of available languages
$translation_config->set_available_langs([
    'en' => [],
    'fr' => []
]);

// Set the default language to "English" ("en")
$translation_config->set_default_lang('en');

// Set the current language to French
$translation_config->set_lang('fr');
```

Loading a (translated) string from the catalog:

```
use \Charcoal\Translation\Catalog;

$catalog = Catalog::instance();
$catalog->add_resource('myproject.csv');
echo $catalog->tr('my string');

// Add a custom string..
$catalog->add_translation('custom string', [
    'en' => 'Custom string',
    'fr' => 'Chaîne aléatoire'
]);
ech $catalog->tr('custom string');
```

Using the `TranslationString` object directly:

```
// Let's assume the default language has been set to 'en'...

use \Charcoal\Translation\TranslationString;

$str = new TranslationString([
    'fr' => 'foo',
    'en' => 'bar'
]);

// All the following examples output "bar"
echo $str;
echo $str->en();
echo $str->val('en');

// All the following examples output "foo"
echo $str->fr();
echo $str->set_lang('fr')->val();
echo $str->val('fr');
//
```

### With Mustache Templates

[](#with-mustache-templates)

By default, all call to the `{{# _t }}` mustache helper in Charcoal Templates will try to translate a string using the default Charcoal Catalog.

For example:

- *Assuming the "my string" has been added to the main catalog, as in the previous example*

Dependencies
------------

[](#dependencies)

- `Charcoal\Config` required by `TranslationConfig`

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.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

Unknown

Total

1

Last Release

3435d ago

### Community

Maintainers

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

---

Top Contributors

[![mcaskill](https://avatars.githubusercontent.com/u/29353?v=4)](https://github.com/mcaskill "mcaskill (41 commits)")[![mducharme](https://avatars.githubusercontent.com/u/12157?v=4)](https://github.com/mducharme "mducharme (8 commits)")

---

Tags

i18nl10ntranslationcharcoal

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/locomotivemtl-charcoal-translation/health.svg)

```
[![Health](https://phpackages.com/badges/locomotivemtl-charcoal-translation/health.svg)](https://phpackages.com/packages/locomotivemtl-charcoal-translation)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69735.1M148](/packages/algolia-algoliasearch-client-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[jms/translation-bundle

Puts the Symfony Translation Component on steroids

44311.1M74](/packages/jms-translation-bundle)[loco/loco

Loco SDK for PHP, including REST API client

19650.7k4](/packages/loco-loco)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)

PHPackages © 2026

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