PHPackages                             asm/translation-loader-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. asm/translation-loader-bundle

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

asm/translation-loader-bundle
=============================

Symfony2 bundle with database translation loader

v1.0.7(11y ago)2313.2k9[11 issues](https://github.com/maschmann/TranslationLoaderBundle/issues)[3 PRs](https://github.com/maschmann/TranslationLoaderBundle/pulls)1MITPHPPHP &gt;=5.3.0

Since Jan 12Pushed 6y ago3 watchersCompare

[ Source](https://github.com/maschmann/TranslationLoaderBundle)[ Packagist](https://packagist.org/packages/asm/translation-loader-bundle)[ Docs](https://github.com/maschmann/TranslationLoaderBundle)[ RSS](/packages/asm-translation-loader-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (8)Dependencies (13)Versions (10)Used By (1)

TranslationLoaderBundle
=======================

[](#translationloaderbundle)

[![Build Status](https://camo.githubusercontent.com/323d3100b06ab52bab31453c2a61995557b2771b4858f50b5aaa692e9b84320a/68747470733a2f2f7472617669732d63692e6f72672f6d617363686d616e6e2f5472616e736c6174696f6e4c6f6164657242756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/maschmann/TranslationLoaderBundle)[![Latest Stable Version](https://camo.githubusercontent.com/ade36187a70720c634663b9ce8fe5e8d9000e25e70b5c44512a22c608e5040e3/68747470733a2f2f706f7365722e707567782e6f72672f61736d2f7472616e736c6174696f6e2d6c6f616465722d62756e646c652f762f737461626c652e706e67)](https://packagist.org/packages/asm/translation-loader-bundle)[![Total Downloads](https://camo.githubusercontent.com/61fa6000bda02d4a433c744f4f0d7b39f9125091e00b60dfdbc4c2299c145384/68747470733a2f2f706f7365722e707567782e6f72672f61736d2f7472616e736c6174696f6e2d6c6f616465722d62756e646c652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/asm/translation-loader-bundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b886c478b95c7fd82ce28e4f92266168d911106461c054e10da455747d536de5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d617363686d616e6e2f5472616e736c6174696f6e4c6f6164657242756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maschmann/TranslationLoaderBundle/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/a7119e7cfe9cc25bbaf7f397ed936f580cd810a63bfd69aa2a8ee27720b4a722/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f31316565383065612d643730662d343166362d383465362d3331613731343131633765382f6d696e692e706e67)](https://insight.sensiolabs.com/projects/11ee80ea-d70f-41f6-84e6-31a71411c7e8)

[![knpbundles.com](https://camo.githubusercontent.com/4526663557e0fb8adc43b0405394d7baa03557fc3e76aafee0bdaeb9a7198a69/687474703a2f2f6b6e7062756e646c65732e636f6d2f6d617363686d616e6e2f5472616e736c6174696f6e4c6f6164657242756e646c652f62616467652d73686f7274)](http://knpbundles.com/maschmann/TranslationLoaderBundle) [![phpci build status](https://camo.githubusercontent.com/92d0cc36c03474056c343c758af9e5ad93d57b8db64863bab01d5ef64a0f59eb/687474703a2f2f70687063692e6272306b656e2e64652f6275696c642d7374617475732f696d6167652f31)](http://phpci.br0ken.de)

TranslationLoaderBundle allows you to do several cool things with your symfony standard edition translations. It relies mostly on the Translator component and doctrine. So you can...

- import all your bundle's translations (if they are in the default path)
- export all translations in your preferred format
- add translations via commandline

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

[](#installation)

1. Add `asm/translation-loader-bundle` as a dependency of your project:

    ```
    $ composer require asm/translation-loader-bundle "~1.0"
    ```
2. Register the bundle in the kernel:

    ```
    // app/AppKernel.php
    // ...

     public function registerBundles()
     {
         $bundles = array(
             // ...
             new Asm\TranslationLoaderBundle\AsmTranslationLoaderBundle(),
         );

         return $bundles;
     }
    ```
3. If you want the admin gui, add routing config:

    ```
    # app/config/routing.yml

    asm_translation_loader.gui:
        resource: "@AsmTranslationLoaderBundle/Resources/config/routing.yml"
        prefix:   /translation
    ```

How does it work?
-----------------

[](#how-does-it-work)

It's quite simple. For every cache clear you do, the translation dumper is generating a MessageCatalogue in your cache directory from which the application later retrieves all your translations and according fallbacks. So far, so good... We're not changing that but moving the translations from files to a flat database table, so they're (in some cases) easier to change and maintain. After installing and following the setup steps, your cache MessageCatalogue will be created directly from the database.

Getting started
---------------

[](#getting-started)

\###EntityManager You can tell the bundle to use an EntityManager other than your default manager. Therefore you need to add a configuration node to your app/config/config.yml

```
asm_translation_loader:
    driver: orm
    database:
        entity_manager:  # default: null
```

\###History If enabled, the history feature listens on doctrine actions and adds an entry for each change, adding the name of the currently logged-in user.

```
asm_translation_loader:
    history: true # default false
```

\###Setup the translation table

```
php app/console doctrine:schema:update --force
```

This will create the translation table for you, so you can start importing.

\###Importing all translations to database

```
php app/console asm:translations:import
```

**Be careful:** The import might take a while, since the process checks for each translation if it's already present and then either inserts or updates. I'm open to suggestions here ;-) This command also has a "-c" so you can clear the database first. might be a bit faster for larger imports if your table is already filled.

\###Generate dummy translation files or using configuration

```
php app/console asm:translations:dummy
```

Since the TranslationLoader bases on files, you'd have to create empty files like "messages.en\_US.db" for each language you want to use with your translation database. I have not yet found a nice way around that, so for the time being, you can use the dummy file generator which creates such a file for each message domain/locale you have in your db. The files will be placed in app/Resources/translations/\* The other option is configuring the loader for specific locales and message domains:

```
asm_translation_loader:
    resources:
        fr: [ foo, bar ]
        de: baz
        en: ~
    driver: orm
    history: true # default false
    database:
        entity_manager: default
```

\###Delete your old translation files After checking your translation table, you should delete all translation files from your custom bundle's directories. Type a short

```
php app/console ca:cl
```

and check your symfony cache dir for the brand new MessageCatalogue we've now filled from the db :-)

\###Funstuff If you're tired of database-translations, don't despair: Just use the file dumper and re-generate your files!

```
php app/console help asm:translations:dump
```

Check out your translation files in app/Resources/translations and if you remove all \*.db files, your're back on file-mode!

\###Testing I've not yet completed my test-setup and be glad to get a little contribution here ;-)

Contributions
-------------

[](#contributions)

Great thanks got to xabbuh for supporting with refactorings and testing (implementation)! Anyone who wants to contribute is greatly welcome!

License
-------

[](#license)

AsmTranslationLoaderBundle is licensed under the MIT license. See the [LICENSE](Resources/meta/LICENSE) for the full license text.

**Free Software, Hell Yeah!**

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 51% 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 ~58 days

Recently: every ~97 days

Total

8

Last Release

4096d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/113964?v=4)[Jason](/maintainers/asm)[@asm](https://github.com/asm)

---

Top Contributors

[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (76 commits)")[![maschmann](https://avatars.githubusercontent.com/u/157620?v=4)](https://github.com/maschmann "maschmann (72 commits)")[![rufinus](https://avatars.githubusercontent.com/u/343160?v=4)](https://github.com/rufinus "rufinus (1 commits)")

---

Tags

bundlephpsymfonysymfony-bundletranslation-loadertranslation databasesymfony-translation

### Embed Badge

![Health badge](/badges/asm-translation-loader-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/asm-translation-loader-bundle/health.svg)](https://phpackages.com/packages/asm-translation-loader-bundle)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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