PHPackages                             jonathan-neugber/cake-lazytranslations - 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. jonathan-neugber/cake-lazytranslations

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

jonathan-neugber/cake-lazytranslations
======================================

Lazy translations for cakephp

00PHP

Since Jul 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jonathan-neugber/cake-lazytranslations)[ Packagist](https://packagist.org/packages/jonathan-neugber/cake-lazytranslations)[ RSS](/packages/jonathan-neugber-cake-lazytranslations/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

A CakePHP 3 plugin that overrides the default `__` translation function to enable lazy evaluation.

Preface
-------

[](#preface)

For now this is only a prototype/proof of concept.

Use case
--------

[](#use-case)

Let's say you define some translations in a configuration file which is loaded in the `bootstrap.php`. But afterwards in the code the locale in the `I18n` class is changed.

**Result:** The translations in the config are in a different locale than those evaluated after changing the locale.

Solution
--------

[](#solution)

`__` now returns an object that contains everything needed to create the translation but is only evaluated when cast to a string.

Installation
------------

[](#installation)

#### 1. require the plugin in `composer.json`

[](#1-require-the-plugin-in-composerjson)

```
"require": {
	"jonathan-neugber/cake-lazytranslations": "dev-master",
}

```

#### 2. Include the plugin using composer

[](#2-include-the-plugin-using-composer)

Open a terminal in your project-folder and run

```
$ composer update

```

#### 3. Load the plugin `config/functions.php`

[](#3-load-the-plugin-configfunctionsphp)

Now here it gets a bit tricky. As you can't yet set the order of loaded files in the composer.json you need it manually add it in the `index.php` file **BEFORE** the `autoloader.php`(Same applies for the `bin/cake.php` file for the shell).

```
require dirname(__DIR__) . '/vendor/jonathan-neugber/cake-lazytranslations/config/functions.php';
require dirname(__DIR__) . '/vendor/autoload.php';

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca1dbb6ed1d663949e32a423f817513cf382994aae658267e173bc3dfeb5f497?d=identicon)[jonathan-neugber](/maintainers/jonathan-neugber)

---

Top Contributors

[![jonathan-neugber](https://avatars.githubusercontent.com/u/17924468?v=4)](https://github.com/jonathan-neugber "jonathan-neugber (3 commits)")

### Embed Badge

![Health badge](/badges/jonathan-neugber-cake-lazytranslations/health.svg)

```
[![Health](https://phpackages.com/badges/jonathan-neugber-cake-lazytranslations/health.svg)](https://phpackages.com/packages/jonathan-neugber-cake-lazytranslations)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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