Download the PHP package umanit/translation-bundle without Composer

On this page you can find all versions of the php package umanit/translation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package translation-bundle

Translation Bundle

This bundle intends to ease Doctrine entity translations. Unlike most translations libraries, every translation is stored in the same table as the source entity.

Features

Install

Register the bundle to your app/AppKernel.php if it's not done automatically.

Configure your available locales and, optionally, the default one:

That's it!

Integration with Sonata Admin

You will need to add extra stylesheets and JavaScript to your admin interface:

Usage

Make your entity translatable

Implement Umanit\TranslationBundle\Doctrine\TranslatableInterface and use the trait Umanit\TranslationBundle\Doctrine\ModelTranslatableTraiton an entity you want to make translatable.

Translate your entity

Use the service umanit_translation.translator.entity_translator to translate a source entity to a target language.

The $translatedEntity will be persisted with Sonata, jumpstarted with EasyAdmin: with both, you'll be redirected to the edit form.

Every attribute of the source entity will be cloned into a new entity, unless specified otherwise with the EmptyOnTranslate attribute.

Options

Usually, you don't wan't to get all fields of your entity to be cloned. Some should be shared throughout all translations, others should be emptied in a new translation. Two special attributes are provided in order to solve this.

SharedAmongstTranslations

Using this attribute will make the value of your field identical throughout all translations: if you update this field in any translation, all the others will be synchronized. If the attribute is a relation to a translatable entity, it will associate the correct translation to each language.

Note : ManyToMany associations are not supported with SharedAmongstTranslations yet.

EmptyOnTranslate

This attribute will empty the field when creating a new translation.

Filtering your contents

To fetch your contents out of your database in the current locale, you'd usually do something like $repository->findByLocale($request->getLocale()).

Alternatively, you can use the provided filter that will automatically filter any Translatable entity by the current locale, every time you query the ORM. This way, you can simply do $repository->findAll() instead of the previous example.

Add this to your config.yml file:

(Optional) Disable the filter for a specific firewall

Usually you'll need to administrate your contents. For doing so, you can disable the filter by configuring the disabled_firewalls option.

Advanced usage

You can alter the entities to translate or translated, before and after translation using the Umanit\TranslationBundle\Event\TranslateEvent

Integration with admin bundles

Sonata

The bundle will automatically add translations widgets in SonataAdmin if you're using it.

If you want to define a default locale for the admin, configure the default_locale.

The admin will then show only the english contents on the list view.

EasyAdmin 4

The bundle does not automatically apply a filter to only show objects translated in the default locale (if it exists). The filter, however, is activated and can be manually triggered to display existing objects for the desired locale.

Integration with DoctrineSingletonBundle

The bundle will automatically work with the Doctrine Singleton Bundle. If your singleton implements the TranslatableInterface, it will be possible to get one instance per locale.


All versions of translation-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
doctrine/doctrine-bundle Version >=1.6
doctrine/orm Version >=2.9
ramsey/uuid Version >=3.7
symfony/framework-bundle Version ^4.4|^5.2|^6.0
symfony/yaml Version ^4.4|^5.2|^6.0
symfony/security-bundle Version ^4.4|^5.2|^6.0
symfony/property-access Version ^4.4|^5.2|^6.0
twig/twig Version >=2.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package umanit/translation-bundle contains the following files

Loading the files please wait ....