fchris82 / jms-translation-bundle-fork
Puts the Symfony Translation Component on steroids
Installs: 2 636
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 3
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^5.3.3 || ^7.0
- nikic/php-parser: ^1.4 || ^2.0 || ^3.0
- symfony/console: ^2.3 || ^3.0
- symfony/framework-bundle: ^2.3 || ^3.0
- symfony/validator: ^2.3 || ^3.0
- twig/twig: ^1.27 || ^2.0
Requires (Dev)
- matthiasnoback/symfony-dependency-injection-test: ^0.7.6
- nyholm/nsa: ^1.0.1
- phpunit/phpunit: 4.8.27
- psr/log: ^1.0
- sensio/framework-extra-bundle: ^2.3 || ^3.0
- symfony/expression-language: ^2.6 || ^3.0
- symfony/symfony: ^2.3 || ^3.0
README
Differences:
- Command performance upgrade: scan files only once and not per languages!
- Sort source
- Collect the placeholders (
<jms:placeholder>
element) - Move meaning to
jms:meaning
attribute - Custom translated form fields (You can set these in the
jms_translation
-->custom_form_config_names
config place)
jms_translation: custom_form_config_names: - 'title' - 'checkbox_label' - 'minMessage' - 'maxMessage' - 'help' - 'button_label' - 'autolock'
- Handle
addViolation()
,addViolationAt()
andbuildViolation()
functions - Add new Annotation:
AltTrans
. You can add basic translations:
<?php /** * @AltTrans("User has been created: <a href=""mailto:%email%"">%email%</a>", locale="en") * @AltTrans("A felhasználó létre lett hozva: <a href=""mailto:%email%"">%email%</a>", locale="hu") */ $this->trans('user.create.success.%email%', ['%email%' => $user->getEmail()]);
In twig template:
<input type="text" id="username" name="_username" placeholder="{{ 'form.username' | trans() | altTrans('en', 'Username') | altTrans('hu', 'Felhasználónév') }}" />
The double
""
sign is the escaped"
in theAltTrans
annotation value.
- Add new Trans* Annotations:
TransArrayKeys
,TransArrayValues
,TransString
. You can handle the strings in var:
<?php /** @TransArrayValues("error") */ $msgs = [ /** @AltTrans("Error 1", locale="en") */ 'error.msg1', /** @AltTrans("Error 2", locale="en") */ 'error.msg2', /** @AltTrans("Error 3", locale="en") */ 'error.msg3', ]; /** @Ignore */ $this->trans($msgs[$errorId], [], "error");
JMSTranslationBundle
Documentation: Resources/doc
Code License: Resources/meta/LICENSE
Documentation License: Resources/doc/LICENSE