On 26.2.2010 13:07, Michal Zugec wrote:
[...]
> And jsuchome pointed me to one ugly fact : strings are not translatable.
> That's because .js file is not interpreted by rails (to apply
> translation into <%= _("sometext") %>), it's just send as it is.
> Any idea how to translate such string?

It depends on the JavaScript, e.g. jQuery validate plugin allows to define 
custom
error messages (which can be translated by gettext).

Example:

$(document).ready(function(){
  // set validation here...

  $.extend($.validator.messages, {
    required: "<%= _("This value cannot be empty.") -%>"
  });
});


But of course this approach is not generic, the JavaScript must allow such
redefinition...


--

Best Regards

Ladislav Slezák
Yast Developer
------------------------------------------------------------------------
SUSE LINUX, s.r.o.                              e-mail: [email protected]
Lihovarská 1060/12                              tel: +420 284 028 960
190 00 Prague 9                                 fax: +420 284 028 951
Czech Republic                                  http://www.suse.cz/
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to