Download the PHP package krombox/form-auto-translation-bundle without Composer
On this page you can find all versions of the php package krombox/form-auto-translation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download krombox/form-auto-translation-bundle
More information about krombox/form-auto-translation-bundle
Files in krombox/form-auto-translation-bundle
Package form-auto-translation-bundle
Short Description Bundle for autotranslate form fields
License MIT
Homepage https://github.com/krombox/FormAutoTranslationBundle
Informations about the package form-auto-translation-bundle
FormAutoTranslationBundle
Add a possibility to autotranslate form fields on button click. New form type: krombox_auto_translations
.
Requirements
- PHP <=5.4
- Symfony 2.3
- KnpLabs/DoctrineBehaviors(auto installed from composer)
- A2lixTranslationFormBundle(auto installed from composer)
- MicrosoftTranslatorBundle (auto installed from composer)
Installation
Add the repository to your composer.json
"krombox/form-auto-translation-bundle": "dev-master"
Run Composer to install the bundle
php composer.phar update krombox/form-auto-translation-bundle
Add to AppKernel
Register the bundle in /app/AppKernel.php
:
<?php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Krombox\FormAutoTranslationBundle\KromboxFormAutoTranslationBundle(),
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
new MatthiasNoback\MicrosoftTranslatorBundle\MatthiasNobackMicrosoftTranslatorBundle()
);
}
}
Configuration Referance
Configure the bundle in app/config.yml
:
a2lix_translation_form:
locale_provider: default
locales: [ru, en, fr, uk]
default_locale: en
required_locales: [ru, en]
manager_registry: doctrine
templating: "A2lixTranslationFormBundle::default.html.twig"
matthias_noback_microsoft_translator:
oauth:
client_id: **********************
client_secret: *******************
krombox_form_auto_translation:
auto_translated_locales: [ru, en, fr, uk]
locale_provider: default
templating: "KromboxFormAutoTranslationBundle::default.html.twig"
Configure the bundle in app/routing.yml
:
krombox_form_auto_translation:
resource: "@KromboxFormAutoTranslationBundle/Resources/config/routing.yml"
Template must contains bootstrap and fontAwasome for standart way view. So, add them somehow you prefer:
{% block stylesheets %}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
{% endblock %}
Include javascripts template and init autotranslate plugin:
{% block javascripts %}
{% include 'KromboxFormAutoTranslationBundle::javascripts.html.twig' %}
<script>
$(document).ready(function(){
$('.autotranslatable').autotranslate();
});
</script>
{% endblock %}
Use Bootsrap form theme on *.html.twig template for nice look(not necessary):
{% form_theme form
'bootstrap_3_layout.html.twig'
%}
Usage
Now you can use new form type krombox_auto_translations
:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('translations', 'krombox_auto_translations')
...
;
}
All versions of form-auto-translation-bundle with dependencies
doctrine/orm Version ~2.4
doctrine/doctrine-bundle Version ~1.4
symfony/monolog-bundle Version ~2.4
symfony/twig-bundle Version ~2.3
twig/extensions Version ~1.0
a2lix/translation-form-bundle Version ^2.0
knplabs/doctrine-behaviors Version ~1.1
matthiasnoback/microsoft-translator-bundle Version ~0.2