PHPackages                             zicht/messages-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zicht/messages-bundle

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

zicht/messages-bundle
=====================

Zicht Messages bundle

8.0.0(2y ago)127.6k[6 issues](https://github.com/zicht/messages-bundle/issues)[1 PRs](https://github.com/zicht/messages-bundle/pulls)MITPHPPHP ^8.0

Since Nov 19Pushed 5mo agoCompare

[ Source](https://github.com/zicht/messages-bundle)[ Packagist](https://packagist.org/packages/zicht/messages-bundle)[ RSS](/packages/zicht-messages-bundle/feed)WikiDiscussions release/8.x Synced 2mo ago

READMEChangelog (6)Dependencies (7)Versions (82)Used By (0)

ZichtMessagesBundle: manage your translatable messages in the database
======================================================================

[](#zichtmessagesbundle-manage-your-translatable-messages-in-the-database)

The ZichtMessagesBundle provides an Doctrine entity and admin screens for managing messages and have the database provide translations for message keys. Additionally, some console tools are available for your convenience.

Admin
-----

[](#admin)

The admin is based on the SonataAdminBundle.

Console tools
-------------

[](#console-tools)

Some utility console tools are available.

- `zicht:messages:add` adds a message to the database catalogue
- `zicht:messages:load` loads a translation file into the database catalogue
- `zicht:messages:flush` flushes Symfony's translation cache

Installing
----------

[](#installing)

- Make sure the `translations/` directory is present in your project.
    - Using translations is/seems to be dependent on the order of scanned directories. By using this directory we assure we are the last in line, overwriting templates with database.
- Add the db file for each domain-locale combination, for instance: message.en.db
- Add a translation via the CMS.
- Clear the cache with `php app/console cache:clear`
- All existing message states will be *unknown*, you need to update these once by running `zicht:messages:load --sync`

Configure manual cache clear
----------------------------

[](#configure-manual-cache-clear)

Edit your `zicht_admin.yml` and add:

```
zicht_admin:
    rc:
        messages:
            route: zicht_messages_rc_flush
            method: DELETE
            title: Clear translation cache
            button: Clear
```

Message state
-------------

[](#message-state)

The messages-bundle maintains a state for each message, this state can be either *import*, *user*, or *unknown*. You can configure z to import messages on every deploy by adding the following:

```
tasks:
    deploy:
        post:
            - @messages.load_files

```

To ensure that the message state is properly updated, add the following to you z config:

```
messages:
    overwrite_compatibility: false

```

Automatic translation
---------------------

[](#automatic-translation)

Leverage the `zicht:message:translate` command with automatic translation through an API of choice. Kickstart the usage by using the provided Google Translate API.

### Setup

[](#setup)

`composer require google/cloud-translate`

### Configuration

[](#configuration)

Define the Google Translator as a service in your project. Your API key should be the private key from a service account ()

```
parameters:
    env(GOOGLE_API_KEY): '%kernel.root_dir%/config/your-google-api-key.json'
```

```

    %env(json:file:resolve:GOOGLE_API_KEY)%

```

Add a `CompilerPass` to register a `BatchTranslatorInterface` on the `MessageTranslator`:

```
use Zicht\Bundle\MessagesBundle\Translator\GoogleTranslator;
use Zicht\Bundle\MessagesBundle\Translator\MessageTranslator;

/**
 * {@inheritDoc}
 */
public function process(ContainerBuilder $container)
{
    $container
        ->getDefinition(MessageTranslator::class)
        ->addMethodCall('setBatchTranslator', [new Reference(GoogleTranslator::class)]);
}
```

### Usage

[](#usage)

In this example we have copied a `.nl.yaml` to a `es.yaml` and we are informing the command that the sourcelanguage is `nl` and the targetlanguage should be `es`. As we have already renamed the file, only contents of this file will be rewritten.

```
php bin/console zicht:message:translate /dir/to/project/translations/validators.es.(yaml|xlf) --source=nl --target=es
```

### Conditions

[](#conditions)

The targetlanguage (`--target=xx`) is required for `yaml` as it cannot be autodiscovered. For `xlf` we use the `target-language` attribute inside the file, but can be forced by using the target-option as well.

Parameters in the translations are rewritten and not sent to the translation-api to prevent translating them. They should be in the format of `%param%`, `!param` or `{param}`.

If your file is in `xliff`, we only support `1.2`.

If your file is in `yaml`, and has hierarchical contents, this will be lost and the file will be rewritten with single lines containing the full path to your translation.

#### Before

[](#before)

```
app:
   index:
        title: Abc
```

#### After

[](#after)

```
app.index.title: Abc
```

Maintainer(s)
-------------

[](#maintainers)

- Boudewijn Schoon

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity83

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

Recently: every ~94 days

Total

73

Last Release

747d ago

Major Versions

6.0.1 → 7.0.02022-11-11

6.0.2 → 7.0.12023-01-19

5.3.2 → 6.0.32023-04-20

6.0.4 → 7.1.12023-04-21

7.1.1 → 8.0.02024-05-02

PHP version history (7 changes)1.0PHP &gt;=5.3

2.4.0PHP ^5.6

3.0.0PHP ^7.0

5.0.0PHP ^7.1

5.2.0PHP ^7.2 || ^8.0

6.0.0PHP ^7.4 || ^8.0

8.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22889608?v=4)[Fabrique automation](/maintainers/zicht-jenkins)[@zicht-jenkins](https://github.com/zicht-jenkins)

---

Top Contributors

[![erik-zicht](https://avatars.githubusercontent.com/u/33859362?v=4)](https://github.com/erik-zicht "erik-zicht (42 commits)")[![boudewijn-zicht](https://avatars.githubusercontent.com/u/22885475?v=4)](https://github.com/boudewijn-zicht "boudewijn-zicht (32 commits)")[![7ochem](https://avatars.githubusercontent.com/u/2794908?v=4)](https://github.com/7ochem "7ochem (25 commits)")[![pbergman](https://avatars.githubusercontent.com/u/1193198?v=4)](https://github.com/pbergman "pbergman (18 commits)")[![YuenZicht](https://avatars.githubusercontent.com/u/89969537?v=4)](https://github.com/YuenZicht "YuenZicht (10 commits)")[![muhammedeminakbulut](https://avatars.githubusercontent.com/u/8781648?v=4)](https://github.com/muhammedeminakbulut "muhammedeminakbulut (2 commits)")[![VMeijer-Zicht](https://avatars.githubusercontent.com/u/57255942?v=4)](https://github.com/VMeijer-Zicht "VMeijer-Zicht (1 commits)")[![drm](https://avatars.githubusercontent.com/u/154580?v=4)](https://github.com/drm "drm (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zicht-messages-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/zicht-messages-bundle/health.svg)](https://phpackages.com/packages/zicht-messages-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)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[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)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)

PHPackages © 2026

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