Download the PHP package sonofwinter/translation-bundle without Composer
On this page you can find all versions of the php package sonofwinter/translation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sonofwinter/translation-bundle
More information about sonofwinter/translation-bundle
Files in sonofwinter/translation-bundle
Package translation-bundle
Short Description This Bundle provides a translator from Entity
License MIT
Informations about the package translation-bundle
SOWTranslationBundle
This Bundle provides a translator for Symfony entities.
Prerequisites
- PHP 8.2 or higher
- Symfony 7.0 or higher
- Composer
Installation
Open a command console, enter your project directory and execute:
Configuration
Bundle Registration
Register the bundle in your config/bundles.php
:
Available Locales
You can override the default available locales by setting the sow_translation.available_locales
parameter:
Custom Translation Entity
By default, a Translation entity class is provided, but you can create your own translation entity class that extends AbstractTranslation.
To use it, set the sow_translation.translation_class_name
parameter:
Usage
Setting Up Translatable Entities
Your translated entities must implement the Translatable
interface.
Then define translated properties in your entity using either annotations or attributes.
Using Attributes (PHP 8.0+)
Configuration Notes
- The
key
property can be used to specify a different name for the translation key. If not provided, the property name is used. - The
setter
property allows you to specify a custom setter method. If the setter doesn't exist, aTranslatableConfigurationException
will be thrown.
Translation Methods
Translating Entities
Setting Translations
Removing Translations
All versions of translation-bundle with dependencies
symfony/framework-bundle Version ^7.0
symfony/dependency-injection Version ^7.0
symfony/yaml Version ^7.0
doctrine/dbal Version ^3
doctrine/doctrine-bundle Version ^2.15
doctrine/doctrine-migrations-bundle Version ^3.4
doctrine/orm Version ^3.4