PHPackages                             kunstmaan/translator-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. kunstmaan/translator-bundle

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

kunstmaan/translator-bundle
===========================

A bundle which enables editing translations in the admin interface without need for editing the translations files. Translations will be stored in a (default) database and retrieved on the most efficient way possible.

7.3.0(1y ago)50126.3k↓36.7%10[2 issues](https://github.com/Kunstmaan/KunstmaanTranslatorBundle/issues)3MITPHPPHP ^8.1

Since Oct 16Pushed 3mo ago14 watchersCompare

[ Source](https://github.com/Kunstmaan/KunstmaanTranslatorBundle)[ Packagist](https://packagist.org/packages/kunstmaan/translator-bundle)[ Docs](https://github.com/Kunstmaan/KunstmaanTranslatorBundle)[ RSS](/packages/kunstmaan-translator-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (228)Used By (3)

KunstmaanTranslatorBundle
=========================

[](#kunstmaantranslatorbundle)

[![Build Status](https://camo.githubusercontent.com/830b2745200bf0a5b6e9d071cef3a7a239df37b5f1849892d245894d24448453/68747470733a2f2f7472617669732d63692e6f72672f4b756e73746d61616e2f4b756e73746d61616e5472616e736c61746f7242756e646c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/Kunstmaan/KunstmaanTranslatorBundle)[![Total Downloads](https://camo.githubusercontent.com/14dabe3b831201c892b7cd902844e8a5ff642e2faa0793c236a6195014656890/68747470733a2f2f706f7365722e707567782e6f72672f6b756e73746d61616e2f7472616e736c61746f722d62756e646c652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/kunstmaan/translator-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/bcb2de639a7cb4eca3aaa6c5f624315caed2b7e36ae8f98768a3db196fccbbc9/68747470733a2f2f706f7365722e707567782e6f72672f6b756e73746d61616e2f7472616e736c61746f722d62756e646c652f762f737461626c652e706e67)](https://packagist.org/packages/kunstmaan/translator-bundle)[![Analytics](https://camo.githubusercontent.com/ef39e10b1945a047edb5e4db7abe7f74b5df6be4611a7473422521c2ff2df911/68747470733a2f2f67612d626561636f6e2e61707073706f742e636f6d2f55412d333136303733352d372f4b756e73746d61616e2f4b756e73746d61616e5472616e736c61746f7242756e646c65)](https://github.com/igrigorik/ga-beacon)

A bundle which enables editing translations in the admin interface without need for editing the translations files. Translations will be stored in a (default) database and retrieved on the most efficient way possible.

[![Symfony Profiler Example](https://github.com/Kunstmaan/KunstmaanTranslatorBundle/raw/master/Resources/doc/sf2_preview.png)](https://github.com/Kunstmaan/KunstmaanTranslatorBundle/raw/master/Resources/doc/sf2_preview.png)

Installation requirements
-------------------------

[](#installation-requirements)

You should be able to get Symfony &gt;=2.3 up and running before you can install the KunstmaanTranslatorBundle.

Installation instructions
-------------------------

[](#installation-instructions)

Assuming you have installed composer.phar or composer binary:

```
$ composer require kunstmaan/translator-bundle 2.3.*@dev
$ composer require doctrine/migrations dev-master
$ composer require doctrine/doctrine-migrations-bundle dev-master
```

Add the KunstmaanTranslatorBundle to your AppKernel.php file:

```
new Kunstmaan\TranslatorBundle\KunstmaanTranslatorBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
```

Add the KunstmaanTranslatorBundle to your routing.yml. Take your own routing into account, it's possible you will need to add the following code prior to your own routing configurations

```
KunstmaanTranslatorBundle:
    resource: "@KunstmaanTranslatorBundle/Resources/config/routing.yml"
    prefix:   /{_locale}/
    requirements:
        _locale: "%requiredlocales%"
```

Configuration
-------------

[](#configuration)

Overwrite the KunstmaanTranslatorBundle config to your needs in config.yml, these are the default values:

```
kunstmaan_translator:
    enabled:         true
    default_bundle:  own
    bundles:         []
    cache_dir:       %kernel.cache_dir%/translations
    managed_locales: []
    file_formats:    ['yml', 'yaml', 'xliff']
    debug:           defaults to the kernel.debug parameter (boolean)
```

- `enabled` : Enabled or disable the KunstmaanTranslatorBundle
- `default_bundle` : Which bundles are used for the import functionality in the backend. Possible values: 'own', 'all', 'custom'.
    - own : All bundles in your src directory
    - all : All bundles in your src directory + all bundles in your vendor directory
    - custom : Only the bundles you specify in `bundles`
- `bundles` : A list of bundles that will be used for the import functionality in the backend. Only used when `default_bundle` is set to 'custom'.
- `cache_dir` : Cached translations dir
- `managed_locales` : Which locale translation files should be imported
- `file_formats` : Which type of translation files should be imported
- `debug` : When debug is enabled the translation caching is disabled

Example configurations:

```
kunstmaan_translator:
    managed_locales: ['en', 'fr', 'es']
```

```
kunstmaan_translator:
    default_bundle: own
    managed_locales: ['en', 'fr', 'es']
    debug: false
```

```
kunstmaan_translator:
    enabled: true
    default_bundle: custom
    bundles: ['MyCompanyCoolBundle', 'MyCompanyAwesomeBundle']
    managed_locales: ['en', 'fr', 'es']
```

Database schema
---------------

[](#database-schema)

Update your database schema with doctrine

```
bin/console doctrine:schema:update --force

Database schema updated successfully! "1" queries were executed
```

Migrate dev translations to production
--------------------------------------

[](#migrate-dev-translations-to-production)

Use the following command to generate a doctrine migration with all new and updated translations from your current environment.

```
bin/console kuma:translator:migrations:diff

```

When you want to include these migrated translations into your (other) environment use the normal doctrine migrate command.

```
bin/console doctrine:migrations:migrate

```

Import existing translation files
---------------------------------

[](#import-existing-translation-files)

When migrating your current project you can easily import the existing translation files.

Without parameters, all translations, locales from the current `main` project will be included. If you have already existing translations in the database with the same combination of 'domain', 'keyword', 'locale', non of them will be overwritten

```
bin/console kuma:translator:import

```

To force overwrite the existing translations in the stasher:

```
bin/console kuma:translator:import --force

```

To import translations from a specific bundle:

```
bin/console kuma:translator:import --bundle=superCoolNewApplicationBundle

```

To import only specific locales:

```
bin/console kuma:translator:import --locales=nl,fr,de

```

To import translations from the global Resources (app/Resources/translations)

```
bin/console kuma:translator:import --globals

```

How does the cache work
-----------------------

[](#how-does-the-cache-work)

Translations are stored in a database, but cached (as Symfony normally does) when not running in debug mode.

```
$kernel = new AppKernel('prod', false); // translations are cached an read from this cache
```

```
$kernel = new AppKernel('dev', true); // translations are always loaded from the stash (slower, more queries)
```

When editing translations in the backend changes aren't immediately visible on your website. The backend will show a warning message when not newer or updated translations aren't loaded into the cache. Click on the `Refresh live` button to rebuild the cache.

Clear cache and request status
------------------------------

[](#clear-cache-and-request-status)

Clear translation cache files, this will trigger a rebuild of the translation cache when visiting a page

```
bin/console kuma:translator:cache --flush

```

Request status of the current cache

```
bin/console kuma:translator:cache --status

```

Reset translation flags
-----------------------

[](#reset-translation-flags)

When all translations are up to date, e.g when migrated all develop translations into production. You need to reset all the flags which mark translations as new or updated. Otherwise already migrated translations will be added into later migrations again (which can cause errors with inserts and unique keys)

```
bin/console kuma:translator:flag --reset

```

Lookup keyword/domain of your translations
------------------------------------------

[](#lookup-keyworddomain-of-your-translations)

You probably don't always remember which keyword and/or domain your translations on specific pages are using. To solve this problem you can add an extra GET parameter to your request. Add `?transSource=1` to your url to see all sources of the translated labels.

You instead of "Hello world" you might see `header.hello_world (messages)`. This means:

- keyword is header.hello\_world
- domain is messages

Symfony Profiler integration
----------------------------

[](#symfony-profiler-integration)

The Symfony Profiler show the number of translations used on the current request:

[![Symfony Profiler Example](https://github.com/Kunstmaan/KunstmaanTranslatorBundle/raw/master/Resources/doc/sf2_profiler_bar.png)](https://github.com/Kunstmaan/KunstmaanTranslatorBundle/raw/master/Resources/doc/sf2_profiler_bar.png)

When you click on this item, you can see all translations used on the current request and a link to add or edit them in the Kunstmaan Admin backend.

[![Symfony Profiler Example Table](https://github.com/Kunstmaan/KunstmaanTranslatorBundle/raw/master/Resources/doc/sf2_profiler_table.png)](https://github.com/Kunstmaan/KunstmaanTranslatorBundle/raw/master/Resources/doc/sf2_profiler_table.png)

Workflow example (new project)
------------------------------

[](#workflow-example-new-project)

1. Add translations (with keywords) in your template files (dev)
2. Add the translations of (1) into your backend via "Add Translation" (dev)
3. Repeat 1 &amp; 2
4. Create migrations diff `bin/console kuma:translator:migrations:diff` (dev)
5. Reset translation flags `bin/console kuma:translator:flag --reset` (dev)
6. Deploy your application
7. Execute doctrine migrations `bin/console doctrine:migrations:migrate` (prod)
8. Edit/add translations (prod)
9. When ready editing/adding, click `Refresh live` or `bin/console kuma:translator:cache --flush` (prod)
10. Repeat 7 &amp; 8 when editing/adding translations in prod

Workflow example (existing project)
-----------------------------------

[](#workflow-example-existing-project)

1. Import current translations, click `Import -> Import` or `bin/console kuma:translator:import` (prod/dev)
2. If you did 1 in dev, go to 4 of `"Workflow example (new project)"`, otherwise go to 7 `"Workflow example (new project)"`

Features
--------

[](#features)

- Import bundle/global translations from any type of translation file
- Import only specific translations (onlu from console command)
- Force import to overwrite existing translations with same domain/keyword/locale
- Edit stored translations from the backend interface
- Add new translations from the backend interface
- Translations are cached (if debug is disabled)
- Warning when cached translations aren't up to date with the stored translations
- Clear translation cache to rebuild translations from the stored translations
- Newer or updated translations are flagged
- Create a Doctrine Migrations file with all flagged translations
- Reset all flagged translations (from console command)
- Clear and check translation cache from console command
- Check your page with the keyword and domain of all translations

Development instructions
------------------------

[](#development-instructions)

Run unit tests

```
./vendor/bin/phpunit -c phpunit.xml.dist
```

Run PHP CS Fixer, after [installing php-cs-fixer system wide](https://github.com/fabpot/PHP-CS-Fixer#globally-manual)

```
php-cs-fixer fix .
```

How to create your own file exporter
------------------------------------

[](#how-to-create-your-own-file-exporter)

- Tag your exporter with `translation.exporter
- implement \\Kunstmaan\\TranslatorBundle\\Service\\Exporter\\FileExporterInterface

**NOTE** : exporting isn't stable (yet)

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance64

Regular maintenance activity

Popularity44

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~20 days

Recently: every ~93 days

Total

225

Last Release

92d ago

Major Versions

4.1.x-dev → 5.0.62018-02-06

5.10.2 → 6.0.12021-11-07

5.10.x-dev → 6.0.62022-09-22

6.4.0 → 7.0.0-alpha12024-03-24

6.4.3 → 7.0.52024-04-28

PHP version history (9 changes)v2.3.0PHP &gt;=5.3.3

3.1.0PHP &gt;=5.4.0

3.5.x-devPHP &gt;=5.5.0

5.2.1PHP ^7.1

5.7.0PHP ^7.2

5.9.2PHP ^7.2|^8.0

6.2.0PHP ^8.0

7.1.0-alpha1PHP ^8.1

7.x-devPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/62ecb43e61751f5fc28256b948ef82f76704338a102d5122b2a6b355e8e972df?d=identicon)[Kunstmaan](/maintainers/Kunstmaan)

---

Top Contributors

[![acrobat](https://avatars.githubusercontent.com/u/1374857?v=4)](https://github.com/acrobat "acrobat (100 commits)")[![sandergo90](https://avatars.githubusercontent.com/u/1516413?v=4)](https://github.com/sandergo90 "sandergo90 (31 commits)")[![Devolicious](https://avatars.githubusercontent.com/u/360302?v=4)](https://github.com/Devolicious "Devolicious (21 commits)")[![wimvds](https://avatars.githubusercontent.com/u/777114?v=4)](https://github.com/wimvds "wimvds (16 commits)")[![jverdeyen](https://avatars.githubusercontent.com/u/117409?v=4)](https://github.com/jverdeyen "jverdeyen (13 commits)")[![dannyvw](https://avatars.githubusercontent.com/u/1218389?v=4)](https://github.com/dannyvw "dannyvw (6 commits)")[![mfoti](https://avatars.githubusercontent.com/u/334842?v=4)](https://github.com/mfoti "mfoti (5 commits)")[![fchris82](https://avatars.githubusercontent.com/u/1598178?v=4)](https://github.com/fchris82 "fchris82 (4 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (4 commits)")[![wouterj](https://avatars.githubusercontent.com/u/749025?v=4)](https://github.com/wouterj "wouterj (3 commits)")[![deZinc](https://avatars.githubusercontent.com/u/26066867?v=4)](https://github.com/deZinc "deZinc (3 commits)")[![KunstmaanLabs](https://avatars.githubusercontent.com/u/8841390?v=4)](https://github.com/KunstmaanLabs "KunstmaanLabs (3 commits)")[![MozzyMoz](https://avatars.githubusercontent.com/u/101609732?v=4)](https://github.com/MozzyMoz "MozzyMoz (3 commits)")[![mennowame](https://avatars.githubusercontent.com/u/10498358?v=4)](https://github.com/mennowame "mennowame (2 commits)")[![dbeerten](https://avatars.githubusercontent.com/u/5577291?v=4)](https://github.com/dbeerten "dbeerten (2 commits)")[![krispypen](https://avatars.githubusercontent.com/u/156955?v=4)](https://github.com/krispypen "krispypen (2 commits)")[![mlebkowski](https://avatars.githubusercontent.com/u/848731?v=4)](https://github.com/mlebkowski "mlebkowski (1 commits)")[![hellomedia](https://avatars.githubusercontent.com/u/868734?v=4)](https://github.com/hellomedia "hellomedia (1 commits)")[![pmartelletti](https://avatars.githubusercontent.com/u/557390?v=4)](https://github.com/pmartelletti "pmartelletti (1 commits)")[![delboy1978uk](https://avatars.githubusercontent.com/u/2684575?v=4)](https://github.com/delboy1978uk "delboy1978uk (1 commits)")

---

Tags

translationstranslatorkunstmaan

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kunstmaan-translator-bundle/health.svg)

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

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.6M17](/packages/barryvdh-laravel-translation-manager)[vsch/laravel-translation-manager

Enhanced Laravel Translation Manager

184190.9k2](/packages/vsch-laravel-translation-manager)[om/potrans

Command line tool for translate Gettext with Google Translator API or DeepL API

10515.0k4](/packages/om-potrans)[highsolutions/laravel-translation-manager

Manage Laravel Translations

1518.8k](/packages/highsolutions-laravel-translation-manager)

PHPackages © 2026

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