PHPackages                             funddy/jstranslations-bundle - 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. funddy/jstranslations-bundle

ActiveSymfony-bundle[Localization &amp; i18n](/categories/localization)

funddy/jstranslations-bundle
============================

JsTranslations for Symfony2

v2.0.3(10y ago)82.1k1MITCoffeeScriptPHP &gt;=5.3.3

Since Nov 24Pushed 10y ago1 watchersCompare

[ Source](https://github.com/funddy/jstranslations-bundle)[ Packagist](https://packagist.org/packages/funddy/jstranslations-bundle)[ Docs](https://github.com/funddy/jstranslations-bundle)[ RSS](/packages/funddy-jstranslations-bundle/feed)WikiDiscussions master Synced yesterday

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

JavaScript Translations Bundle
==============================

[](#javascript-translations-bundle)

[![Build Status](https://camo.githubusercontent.com/e74e243b8fe72e9714881d4df51ca31d63c6ed7c2ffee9d9e773ebeb027d852a/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f66756e6464792f6a737472616e736c6174696f6e732d62756e646c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/funddy/jstranslations-bundle)

This bundle enables you to use your Symfony translator from JavaScript, allowing the generate translations in a very similar way.

Setup and Configuration
-----------------------

[](#setup-and-configuration)

First, you should have the Translator enabled at `app/config.yml`

```
framework:
    translator: { fallback: en }
```

Add the following to your `composer.json` file:

```
{
    "require": {
        "funddy/jstranslations-bundle": "2.0.*"
    }
}
```

Update the vendor libraries:

```
curl -s http://getcomposer.org/installer | php
php composer.phar install

```

Register the Bundle FunddyJsTranslationsBundle in `app/AppKernel.php`.

```
public function registerBundles()
{
    $bundles = array(
        new Funddy\Bundle\JsTranslationsBundle\FunddyJsTranslationsBundle()
    );
}
```

For finishing, override the default translator with one which implements the ReadableTranslator interface at `app/parameters.yml` file

```
parameters:
    translator.class: Funddy\Bundle\JsTranslationsBundle\ReadableTranslator\SymfonyReadableTranslator
```

Usage
-----

[](#usage)

Expose the translations that you want to have accessible from your JavaScript code adding the languages and domains to the bundle configuration

```
funddy_js_translations:
    languages: [es, en]
    domains: [messages]
```

Now it's time to decide whether you want to use static or dynamic generated translations.

### Dynamic Translations

[](#dynamic-translations)

This is the most flexible option. Every time you make a change in translations you'll be able to access them from JavaScript. It's ideal for development environment or for those cases where you performance is not an issue. As everything in life, you have to pay a price, which is invoking an URL to regenerate all translations every time you make a request.

Include FunddyJsTranslationsBundle routing at `app/routing.yml`

```
jstranslations:
    resource: "@FunddyJsTranslationsBundle/Resources/config/routing.yml"
```

Include the scripts

```
var TRANSLATIONS_LOCALE = "{{ app.request.locale }}"

```

### Static Translations

[](#static-translations)

Is the best solution when we talk about performance, include compiled translations in order to avoid controller execution.

Compile the translations

```
php app/console funddy:jstranslations:dump

```

Include translations

```
var TRANSLATIONS_LOCALE = '{{ app.request.locale }}'

```

### Have fun!

[](#have-fun)

```

    console.log(Translator.trans('Hello %name%!', {'%name%': 'Charlie'})); //Hello Charlie!
    console.log(Translator.transChoice('{1} There is one apple|]1,19] There are %count% apples', 3, {'%count%': 3}));//There are 3 apples

```

Defining Your Own Translator
----------------------------

[](#defining-your-own-translator)

What if you do not want to use the default "Translator" global var and define your own? Easy, include only translations runtime and define your own translator.

```

    var LOCALE = '{{ app.request.locale }}';
    var MyOwnTranslator = (function() {
        var translator =
            new FUNDDY.JsTranslations.Translator(
                new FUNDDY.JsTranslations.IntervalParser(
                    new FUNDDY.JsTranslations.SetFactory(),
                    new FUNDDY.JsTranslations.IntervalFactory(),
                    new FUNDDY.JsTranslations.IntervalSymbolFactory()
                ),
                TRANSLATIONS, LOCALE
            );

        return {
            trans: translator.trans
            transChoice: translator.transChoice
        };
    })();

    console.log(MyOwnTranslator.trans('Hello %name%!', {'%name%': 'Charlie'}));//Hello Charlie!

```

###  Health Score

31

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.2% 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 ~1021 days

Total

2

Last Release

3991d ago

Major Versions

v1.0.0 → v2.0.32015-09-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2072579?v=4)[Funddy](/maintainers/funddy)[@funddy](https://github.com/funddy)

---

Top Contributors

[![keyvanakbary](https://avatars.githubusercontent.com/u/717129?v=4)](https://github.com/keyvanakbary "keyvanakbary (25 commits)")[![javierhdez3](https://avatars.githubusercontent.com/u/1479069?v=4)](https://github.com/javierhdez3 "javierhdez3 (1 commits)")

---

Tags

translationstranslatorjs translations

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/funddy-jstranslations-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/funddy-jstranslations-bundle/health.svg)](https://phpackages.com/packages/funddy-jstranslations-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M777](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M535](/packages/pimcore-pimcore)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[kimai/kimai

Kimai - Time Tracking

4.8k9.4k1](/packages/kimai-kimai)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M235](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M672](/packages/shopware-core)

PHPackages © 2026

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