Download the PHP package liip/formtranslationchoice-bundle without Composer

On this page you can find all versions of the php package liip/formtranslationchoice-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 formtranslationchoice-bundle

FormTranslationChoiceBundle

UNMAINTAINED

This bundle is no longer maintained. Feel free to fork it if needed.

This Symfony2 bundle provides a form choice field type and a validation constraint that work with translation domains. You can use all strings of a translation domain as values for a field of your entity. The form stores the translation key in the field.

For example, we use it with an entity Person that has a field title. We use a translation domain person_title and maintain all possible titles a person can have (Mr, Ms, Prof, Dr, and so on) in the translation file. The entity stores the translation key and the title can thus be translated as needed. We could even change Mr to Mister without need to change the database.

This does not replace a choice field that links to another entity. But for simple cases like the above example, you might not want to build an admin interface and store such options in the database.

Installation

Composer will ask you for the version of the bundle you want to install. Chose 1.0.* unless you want to lock on a more specific version.

Enable the bundle

Load the bundle in your kernel:

Due to the Symfony2 translator not exposing the translation domains, you need to use the extended translator provided by this bundle. Add the following to your project configuration file:

Usage

This bundle provides a form widget translation_choice and a validation constraint TranslationDomainKey that operate on a whole translation domain.

Warning: When using this, you want to make sure you have complete translation for the used domain, or none at all. This bundle does not merge different languages, but does fall back to the default language if the requested language does not exist.

translation_choice Form Field Type

The translation_choice field type is based on the core choice and provides all translations of the specified domain as choices. You can use the options of the standard Symfony2 choice field type. It makes no sense to specify the choice or choice_list argument though, as they come from the translation domain.

To select the translation domain to use, the translation_domain option is required.

By default, the request locale is used, but you can set the locale option if you need to override this.

By default the values are sorted alphabetically. If you don't want them to be sorted use the `sorted' option set to false.

Validation constraint

This bundle provides a validation constraint that ensures that a field has a value that is a key in the specified translation domain. As with all validators, this validator accepts null and empty string as well, so you additionally want a NotBlank validation if empty values should not be allowed.

License

This bundle is licensed under the MIT license. Please see the file LICENSE for more.


All versions of formtranslationchoice-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
symfony/framework-bundle Version ~2.1
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 liip/formtranslationchoice-bundle contains the following files

Loading the files please wait ....