Also, This error can occur if you don't return an array in the Php file, so return a simple array to fix the error :
"<?php return array();" Le vendredi 9 septembre 2011 21:18:41 UTC+2, Felix Köhler a écrit : > > Ups, that's embarrasing... :$ you're right! > > In my copy-paste-try-it-all-out fiever I forgot to think a little hehehe! > > Thank you! > > 2011/9/9 ryan weaver <[email protected]> > >> Hi Jose! >> >> I've just tried this and it works fine. However, did you possibly forget >> the open PHP tag in your messages.en.php file? That would cause this error >> :) >> >> Good luck! >> >> Ryan Weaver >> US Office Head & Trainer - KnpLabs - Nashville, TN >> http://www.knplabs.com <http://www.knplabs.com/en> >> http://www.thatsquality.com >> Twitter: @weaverryan >> >> >> >> On Thu, Sep 8, 2011 at 6:08 PM, Jose Gallop <[email protected]>wrote: >> >>> When I use a php file as dictionary >>> (Resources/translations/messages.en.php) I get following exception: >>> >>> An exception has been thrown during the rendering of a template >>> ("Catchable Fatal Error: Argument 1 passed to >>> Symfony\Component\Translation\Loader\ArrayLoader::flatten() must be an >>> array, integer given, called >>> in >>> my_project/vendor/symfony/src/Symfony/Component/Translation/Loader/ArrayLoader.php >>> >>> on line 32 >>> >>> >>> content of the php file: >>> return array( >>> 'translate me' => 'translated', >>> ); >>> >>> in my twig template: >>> {% trans %}translate me{% endtrans %} >>> >>> with xliff and yml dictionary files everything works fine... >>> >>> Symfony2 Rocks! >>> >>> Cheers >>> >>> -- >>> If you want to report a vulnerability issue on symfony, please send it >>> to security at symfony-project.com >>> >>> You received this message because you are subscribed to the Google >>> Groups "symfony developers" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/symfony-devs?hl=en >>> >> >> -- >> If you want to report a vulnerability issue on symfony, please send it to >> security at symfony-project.com >> >> You received this message because you are subscribed to the Google >> Groups "symfony developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/symfony-devs?hl=en >> > > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
