leyer / translation-addition
This bundles enables edition of translations directly from your application user interface using Javascript.
Installs: 155
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
Type:bundle
Requires
- php: >=5.4.0
Requires (Dev)
- jms/translation-bundle: >=1.1
This package is not auto-updated.
Last update: 2024-12-21 17:43:23 UTC
README
This bundles enables edition of translations directly from your application user interface using Javascript.
Installation
Install the bundle with composer:
composer require "leyer/translation-addition"
You have to register the bundle in app/AppKernel.php
:
public function registerBundles() { if (in_array($this->getEnvironment(), ['dev', 'test'])) { $bundles[] = new Leyer\TranslationAdditionBundle\LeyerTranslationAdditionBundle(); } }
If you use the AsseticBundle, you should publish this bundle's assets:
assetic: bundles: - LeyerTranslationAdditionBundle
php app/console assets:install --symlink web
JQuery is required for inline edition, it can be installed with bower.
A symfony bundle is available here.
Usage
Edit translation inline
Inline edition require a translation updater.
If you used JMSTranslationBundle an adapter updater is already available. Don't forget to add at least one configuration:
leyer_translation_addition: inline_translation: ~ jms_translation: configs: app: dir: [%kernel.root_dir%] output_dir: %kernel.root_dir%/Resources/translations
If you want to used your own updater, you must implement TranslationUpdaterInterface and enable your updater service in the configuration:
leyer_translation_addition: inline_translation: updater: my_adapter_definition
Register the routing in app/config/routing_dev.yml:
_leyer_translation_addition: resource: "@LeyerTranslationAdditionBundle/Resources/config/routing.yml" prefix: /_trans
Now you must include js and css files:
{% if app.environment == 'dev' %} <script src="{{ asset('bundles/leyertranslationaddition/js/translator.js') }}" type="text/javascript"></script> {% endif %}
{% if app.environment == 'dev' %} <link rel="stylesheet" href="{{ asset('bundles/leyertranslationaddition/css/translator.css') }}"/> {% endif %}
To do:
Tooltip css.