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 2w 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://avatars.githubusercontent.com/u/17924468?v=4)[Gabriel Neugber](/maintainers/jonathan-neugber)[@jonathan-neugber](https://github.com/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

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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