APYJsFormValidationBundle icon indicating copy to clipboard operation
APYJsFormValidationBundle copied to clipboard

[Translation] Make placeholder prefix and suffix configurable

Open hruben opened this issue 12 years ago • 4 comments

JSFV uses the same error messages as the Symfony constraints. So it appears only natural to me to use the same placeholder marks. However, jsfv.getComputeMessage() always sets these marks to '{{ ' and ' }}'. It would save a lot of effort to have some easy way of changing this back to the ExposeTranslationBundle's default value of '%'. One option is to make the placeholder prefix and suffix a parameter in parameters.yml. Another option is to add a block around jsfv.getComputeMessage() so that it can be easily overridden.

hruben avatar Jul 22 '13 10:07 hruben

@Abhoryo why do we use braces? I agree with @hruben we need to use "%" by default.

recipe avatar Jul 22 '13 16:07 recipe

Braces were the ExposeTranslationBundle's default value.

Abhoryo avatar Jul 23 '13 07:07 Abhoryo

In 0.3.x-dev, it's '%', see vendor/willdurand/expose-translation-bundle/Bazinga/ExposeTranslationBundle/Resources/public/js/translator.js line 335. And even if it was the default value, I would like to be able to change it. The intention is to use the same translations for PHP and JS generated messages, so '%' surely makes sense.

hruben avatar Jul 23 '13 07:07 hruben

You can change the default for the moment.

Abhoryo avatar Jul 23 '13 08:07 Abhoryo