PHPackages                             wvdongen/cakephp-i18njs - 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. wvdongen/cakephp-i18njs

ActiveCakephp-plugin[Localization &amp; i18n](/categories/localization)

wvdongen/cakephp-i18njs
=======================

Translate JavaScript strings like Drupal 8.

57.6k3[1 issues](https://github.com/wvdongen/CakePHP-I18nJs/issues)PHP

Since Nov 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/wvdongen/CakePHP-I18nJs)[ Packagist](https://packagist.org/packages/wvdongen/cakephp-i18njs)[ RSS](/packages/wvdongen-cakephp-i18njs/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

I18nJs Plugin for CakePHP
=========================

[](#i18njs-plugin-for-cakephp)

A CakePHP 2.x plugin to translate JavaScript strings. The JavaScript functions and methods to fetch the translation strings are taken from Drupal 8.

How to include
--------------

[](#how-to-include)

- Put the files in `APP/Plugin/I18nJs`
- Make sure you have `CakePlugin::load('I18nJs')` or `CakePlugin::loadAll()` in your bootstrap
- Include the JavaScript lib to your HTML `$this->Html->script('/i18n_js/js/18n_js')`
- Add generated JavaScript translation file `$this->Html->script('/js/Locale/i18n_js.' . $this->Session->read('Config.language'))`

JavaScript functions
--------------------

[](#javascript-functions)

### I18nJs.t(str, args, options)

[](#i18njststr-args-options)

Translate strings to the page language or a given language.

Examples:

```
I18nJs.t('This string needs transalation');
I18nJs.t('Welcome @name', {'@name': 'Wouter'});
```

### I18nJs.t(count, singular, plural, args, options)

[](#i18njstcount-singular-plural-args-options)

Format a string containing a count of items.

Examples:

```
Drupal.formatPlural(count, '@name has 1 site.', '@name has @count sites.', {'@name': personName});
Drupal.formatPlural(count, '1 comment', '@count comments');
```

Generate .pot file
------------------

[](#generate-pot-file)

```
Console/cake I18nJs.i18n_js extract_js
```

This will parse all the javascript translation functions from your .js and .ctp files. This will create the file `App/Locale/i18n_js.pot`.

Create JavaScript translation file
----------------------------------

[](#create-javascript-translation-file)

Make sure your translations are located in `App/Locale//LC_MESSAGES/i18n_js.po`.

```
Console/cake I18nJs.i18n_js create_js
```

This will create JavaScript file(s) as `App/webroot/js/Locale/i18n_js..js`.

This fill should be added to your HTML. Add for example the following to your `default.ctp` file:

```
echo $this->Html->script('/js/Locale/i18n_js.' . $this->Session->read('Config.language'));
```

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ea932f9963b9bb6572379aa9e50d6adb3053946d523db23405a3996f594e8df?d=identicon)[wvdongen](/maintainers/wvdongen)

---

Top Contributors

[![wvdongen](https://avatars.githubusercontent.com/u/1862615?v=4)](https://github.com/wvdongen "wvdongen (8 commits)")[![amanhiche](https://avatars.githubusercontent.com/u/46284899?v=4)](https://github.com/amanhiche "amanhiche (1 commits)")[![kdyouri](https://avatars.githubusercontent.com/u/7106666?v=4)](https://github.com/kdyouri "kdyouri (1 commits)")[![kim-dongit](https://avatars.githubusercontent.com/u/17615168?v=4)](https://github.com/kim-dongit "kim-dongit (1 commits)")

### Embed Badge

![Health badge](/badges/wvdongen-cakephp-i18njs/health.svg)

```
[![Health](https://phpackages.com/badges/wvdongen-cakephp-i18njs/health.svg)](https://phpackages.com/packages/wvdongen-cakephp-i18njs)
```

###  Alternatives

[smarty-gettext/smarty-gettext

Gettext plugin enabling internationalization in Smarty Package files

752.5M8](/packages/smarty-gettext-smarty-gettext)[devaslanphp/auto-translate

Auto generate translation JSON files

6627.3k](/packages/devaslanphp-auto-translate)

PHPackages © 2026

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