PHPackages                             whitedigital-eu/translation-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. whitedigital-eu/translation-bundle

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

whitedigital-eu/translation-bundle
==================================

Translation API Resource

0.2.0(1y ago)06061MITPHPPHP &gt;=8.2.0

Since Aug 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/whitedigital-eu/translation-bundle)[ Packagist](https://packagist.org/packages/whitedigital-eu/translation-bundle)[ RSS](/packages/whitedigital-eu-translation-bundle/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (25)Versions (10)Used By (0)

Translation Bundle
==================

[](#translation-bundle)

A Symfony bundle that provides translation management capabilities through API Platform, with support for multiple locales and domains.

Features
--------

[](#features)

- API Platform integration for translation management
- Support for multiple locales and domains
- Database-backed translation storage
- Cache support for improved performance
- Command-line tools for translation management
- Integration with Lexik Translation Bundle
- Support for translatable entities

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Symfony 6.x
- API Platform 3.x
- Doctrine ORM

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

[](#installation)

1. Install the bundle using Composer:

```
composer require whitedigital-eu/translation-bundle
```

2. Add the bundle to your `config/bundles.php`:

```
return [
    // ...
    WhiteDigital\Translation\TranslationBundle::class => ['all' => true],
];
```

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

[](#configuration)

Create a configuration file `config/packages/translation.yaml`:

```
translation:
    entity_manager: default  # Optional: defaults to 'default'
    locale: en              # Default locale for translations
    translation_fallback: false  # Whether to use translation fallback
    managed_locales: ['en', 'lv']  # List of managed locales
    cache_pool: cache.app    # Optional: Cache pool to use for translations
```

Usage
-----

[](#usage)

### 1. Translatable Entities

[](#1-translatable-entities)

To make an entity translatable, extend the `AbstractTranslatableEntity` class:

```
use WhiteDigital\Translation\Entity\AbstractTranslatableEntity;
use Gedmo\Mapping\Annotation as Gedmo;

class YourEntity extends AbstractTranslatableEntity
{
    #[Gedmo\Translatable]
    private ?string $name = null;

    // ... getters and setters
}
```

### 2. API Endpoints

[](#2-api-endpoints)

The bundle provides the following API endpoints:

- `GET /api/trans_units` - List all translation units
- `GET /api/trans_units/{id}` - Get a specific translation unit
- `POST /api/trans_units` - Create a new translation unit
- `PATCH /api/trans_units/{id}` - Update a translation unit
- `DELETE /api/trans_units/{id}` - Delete a translation unit
- `GET /api/trans_units/list/{locale}` - Get translations for a specific locale

### 3. Command Line Tools

[](#3-command-line-tools)

The bundle provides several command-line tools. There are two ways to use these commands depending on your setup:

#### When using SiteTree:

[](#when-using-sitetree)

Each locale is passed as a separate option with its corresponding file path:

```
# Import translations
bin/console wd:trans_unit:import --en=/path/to/en.json --lv=/path/to/lv.json

# Override translations
bin/console wd:trans_unit:override --en=/path/to/en.json --lv=/path/to/lv.json
```

#### Without SiteTree:

[](#without-sitetree)

Locales and files are passed as comma-separated lists:

```
# Import translations
bin/console wd:trans_unit:import --locales=en,lv --files=/path/to/en.json,/path/to/lv.json

# Override translations
bin/console wd:trans_unit:override --locales=en,lv
```

### 4. Translation Format

[](#4-translation-format)

When creating or updating translations via API, use the following format:

```
{
    "key": "translation.key",
    "domain": "messages",
    "translations": {
        "en": "English translation",
        "lv": "Latvian translation"
    }
}
```

### 5. Cache Management

[](#5-cache-management)

The bundle supports caching of translations for improved performance. Configure the cache pool in your configuration:

```
translation:
    cache_pool: cache.app
```

The cache is automatically invalidated when translations are updated.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

This bundle is released under the MIT license. See the included [LICENSE](LICENSE) file for more information.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance45

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.8% 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 ~203 days

Total

4

Last Release

429d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38725938?v=4)[Dāvis Zālītis](/maintainers/k0d3r1s)[@k0d3r1s](https://github.com/k0d3r1s)

---

Top Contributors

[![k0d3r1s](https://avatars.githubusercontent.com/u/38725938?v=4)](https://github.com/k0d3r1s "k0d3r1s (56 commits)")[![raraworks](https://avatars.githubusercontent.com/u/18421085?v=4)](https://github.com/raraworks "raraworks (3 commits)")[![acirulis](https://avatars.githubusercontent.com/u/27766961?v=4)](https://github.com/acirulis "acirulis (2 commits)")

---

Tags

phpsymfonytranslationSymfony Bundleapi-platform

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/whitedigital-eu-translation-bundle/health.svg)

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M376](/packages/easycorp-easyadmin-bundle)[sulu/sulu

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

1.3k1.4M196](/packages/sulu-sulu)[open-dxp/opendxp

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

9317.2k55](/packages/open-dxp-opendxp)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M519](/packages/shopware-core)[sylius/sylius

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

8.5k5.8M712](/packages/sylius-sylius)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1615.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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