Download the PHP package whitedigital-eu/translation-bundle without Composer
On this page you can find all versions of the php package whitedigital-eu/translation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download whitedigital-eu/translation-bundle
More information about whitedigital-eu/translation-bundle
Files in whitedigital-eu/translation-bundle
Package translation-bundle
Short Description Translation API Resource
License MIT
Informations about the package translation-bundle
Translation Bundle
A Symfony bundle that provides translation management capabilities through API Platform, with support for multiple locales and domains.
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
- PHP 8.2 or higher
- Symfony 6.x
- API Platform 3.x
- Doctrine ORM
Installation
-
Install the bundle using Composer:
- Add the bundle to your
config/bundles.php:
Configuration
Create a configuration file config/packages/translation.yaml:
Usage
1. Translatable Entities
To make an entity translatable, extend the AbstractTranslatableEntity class:
2. API Endpoints
The bundle provides the following API endpoints:
GET /api/trans_units- List all translation unitsGET /api/trans_units/{id}- Get a specific translation unitPOST /api/trans_units- Create a new translation unitPATCH /api/trans_units/{id}- Update a translation unitDELETE /api/trans_units/{id}- Delete a translation unitGET /api/trans_units/list/{locale}- Get translations for a specific locale
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:
Each locale is passed as a separate option with its corresponding file path:
Without SiteTree:
Locales and files are passed as comma-separated lists:
4. Translation Format
When creating or updating translations via API, use the following format:
5. Cache Management
The bundle supports caching of translations for improved performance. Configure the cache pool in your configuration:
The cache is automatically invalidated when translations are updated.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This bundle is released under the MIT license. See the included LICENSE file for more information.
All versions of translation-bundle with dependencies
api-platform/core Version ^3
doctrine/dbal Version *
doctrine/doctrine-bundle Version *
doctrine/orm Version *
doctrine/persistence Version *
lexik/translation-bundle Version *
symfony/cache Version *
symfony/cache-contracts Version *
symfony/config Version *
symfony/console Version *
symfony/dependency-injection Version *
symfony/event-dispatcher Version *
symfony/filesystem Version *
symfony/finder Version *
symfony/form Version *
symfony/http-kernel Version *
symfony/serializer Version *
symfony/service-contracts Version *
symfony/translation Version *
symfony/validator Version *
symfony/yaml Version *
whitedigital-eu/entity-resource-mapper-bundle Version ^0.24