Thanks Gediminas, I solved the problem like you instructed: # Resources/translations/messages.en.yml feedback: give_feedback: Give feedback title: Title message: Message thankyou: Thank you for the feedback system: send: Send cancel: Cancel ...
# js/lang_en.js var lang = { "feedback": { "give_feedback": "Give feedback", "title": "Title", "message": "Message", "thankyou": "Thank you for the feedback" }, "system": { "send":"Send", "cancel":"Cancel" } }; lang_xx.js is loaded depending on the chosen locale. JS function trans(), will return translated string with given key. Example: trans('feedback.thankyou') I also need to create batch script which will generate language JS-files from yaml translations. There I can also control that only needed sections will be written to JS-files. -Leo- From: symfony-users@googlegroups.com [mailto:symfony-users@googlegroups.com] On Behalf Of Gediminas Morkevicius Sent: 9. toukokuuta 2011 16:08 To: symfony-users@googlegroups.com Subject: Re: [symfony-users] Symfony2 JS i18n: How to translate Javascript strings? I will be unmaintanable crap very fast, trust me. JS CSS and HTML is like MVC you have to separate it. That way the code will be maintainable On Mon, May 9, 2011 at 2:42 PM, Donald Tyler <chekot...@gmail.com<mailto:chekot...@gmail.com>> wrote: @Gediminas Im curious: Why not use JS with twig? If you need dynamic JS, it seems like a logical solution. On Mon, May 9, 2011 at 3:34 AM, Gediminas Morkevicius <gediminas.morkevic...@gmail.com<mailto:gediminas.morkevic...@gmail.com>> wrote: old fashioned way as for javascript, I recommend including different js file. thats my opinion. I surely do not recommend mixing the js with twig On Mon, May 9, 2011 at 10:20 AM, Leo Jokinen <leo.joki...@snoobi.com<mailto:leo.joki...@snoobi.com>> wrote: Hi all, I want to translate JS strings at Symfony 2 but seems that framework does not support that directly. Any idea how to accomplish this? Found this article, but it's not Symfony 2: http://kahthong.com/symfony-framework-using-i18n-translation-feature-javascript-files -Leo- -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com<http://symfony-project.com> You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com<mailto:symfony-users@googlegroups.com> To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com<mailto:symfony-users%2bunsubscr...@googlegroups.com> For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com<http://symfony-project.com> You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com<mailto:symfony-users@googlegroups.com> To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com<mailto:symfony-users%2bunsubscr...@googlegroups.com> For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com<http://symfony-project.com> You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com<mailto:symfony-users@googlegroups.com> To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com<mailto:symfony-users%2bunsubscr...@googlegroups.com> For more options, visit this group at http://groups.google.com/group/symfony-users?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 users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?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 users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en