Note that there are some explanatory texts on larger screens.

plurals
  1. POSilex form validator translations not being set from Yaml
    primarykey
    data
    text
    <pre><code>// Forms $app-&gt;register(new FormServiceProvider()); $app-&gt;register(new Silex\Provider\ValidatorServiceProvider()); // Locale $app-&gt;register(new Silex\Provider\TranslationServiceProvider(), array( 'locale' =&gt; 'en', 'locale_fallback' =&gt; 'en' )); $app['translator']-&gt;addLoader('yaml', new Symfony\Component\Translation\Loader\YamlFileLoader()); $app['translator']-&gt;addResource('yaml', $app['root_dir'] .'/config/poseidon/locales/en.yml', 'en'); $app['translator']-&gt;addResource('yaml', $app['root_dir'] .'/config/poseidon/locales/validators.en.yml', 'en', 'validators'); </code></pre> <p>This is how part of my index.php looks. The messages domain is fine however the validators domain is not. This is because the default form translations in the xlf files mean the yml file I am loading does not apply.</p> <p>For example if I edit the xlf file and delete:</p> <p>This value should not be blank.</p> <p>Then my yml file:</p> <pre><code># validators.en.yml This value should not be blank.: This is a required field </code></pre> <p>Will be loaded and this key will be added to the validators array. However it seems as long as those default xlf files are being loaded, nothing from my yaml file will be able to overwrite the validators translation domain.</p> <p>Any help would be appreciated as I am out of ideas as to why this is happening. Thanks.</p> <p>EDIT:</p> <p>This is actually the opposite way round to what I thought, I added in:</p> <pre><code>echo $app['translator']-&gt;trans( 'This value should not be blank.', array(), 'validators' ); </code></pre> <p>Directly after the translator adds the resource and got the expected result which means that when the FormServiceProvider is being loaded the default xlf file is the one overwriting what currently exists in the message catalogue validators domain.</p> <p>So if anyone know how to prevent it from doing this that would be great, thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload