2017 © Pedro Peláez
 

symfony-bundle jms-translation-bundle-fork

Puts the Symfony Translation Component on steroids

image

fchris82/jms-translation-bundle-fork

Puts the Symfony Translation Component on steroids

  • Tuesday, February 27, 2018
  • by fchris82
  • Repository
  • 2 Watchers
  • 4 Stars
  • 1,891 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 19 Versions
  • 13 % Grown

The README.md

JMSTranslationBundle fork

Differences:, (*1)

  • 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() and buildViolation() 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:, (*2)

<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 the AltTrans annotation value., (*3)

  • 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 Build Status Join the chat at https://gitter.im/schmittjoh/JMSTranslationBundle

Documentation: Resources/doc, (*4)

Code License: Resources/meta/LICENSE, (*5)

Documentation License: Resources/doc/LICENSE, (*6)

The Versions