On 10/08/2010 02:03 PM, halk wrote:
Hello all,Fabien told us in his keynote on symfony day 2010 in Cologne today, that Symfony2's new Translation component has a fallback for the culture/locale built-in. Fabien gave this example: "fr_FR", "fr", "en". If there is no translation "fr_FR", Symfony2 looks for "fr", if not then "en" (as set in configuration). After Fabien's keynote someone asked him whether the user can define the fallback order. Fabien answered that it is not implemented yet. Does Symfony2 read the user's preferred languages from browser? In Zend Framework I can tell ZF to read the browser preference: $translate = new Zend_Translate( 'gettext', APPLICATION_PATH . '/langs', $locale->getLanguage(), array( 'scan' => Zend_Translate::LOCALE_FILENAME, 'disableNotices' => true ) ); $locale->getLanguage() parses the $_SERVER['HTTP_ACCEPT_LANGUAGE'] variable and returns an array of preferred languages. I believe that if the customer/project asks for it and the developer tells Symfony2 to do (f.e. as a parameter), Symfony2 should read this setting and use it for selecting the translation and for fallback. F.e. if "de_DE", "tr_TR" and "en_GB" are the preferred languages set in the user's browser, Symfony2 should first look for the translations "de_DE", then "de". If still no match, it should try to find a translation catalogue for the next preferred language, in this case "tr_TR" and if not "tr" etc. If non of the preferred languages matches, Symfony2 will take the culture defined in configuration. What do you think? I could write a patch if the idea sounds good for you.
Sounds fantastic to me. -- 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
