Mailinglist Archive: yast-devel (59 mails)

< Previous Next >
Re: [yast-devel] WebYaST: javascript per-plugin library
  • From: Ladislav Slezak <lslezak@xxxxxxx>
  • Date: Mon, 01 Mar 2010 12:47:25 +0100
  • Message-id: <4B8BA94D.5080304@xxxxxxx>
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: lslezak@xxxxxxx
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: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages