Mailinglist Archive: yast-devel (127 mails)

< Previous Next >
Re: [yast-devel] WebYaST: javascript per-plugin library
  • From: Michal Zugec <mzugec@xxxxxxx>
  • Date: Fri, 26 Feb 2010 13:44:28 +0100
  • Message-id: <4B87C22C.60302@xxxxxxx>
On 26.02.2010 13:22, Josef Reidinger wrote:
Michal Zugec write:
On 26.02.2010 12:36, Michal Zugec wrote:
I'd like to share my observation:
I needed to share my javascript code between two files (it was form
validation for new and edit action + some more)
I created

and included it into my files with <%= javascript_include_tag
"users_edit.js" %>

It's important to use $pluginname as prefix to be unique in whole project!

That's it ...


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?


Reason is simple, you add javascript to public directory which is jsut
served. I already look at this issue (not-supported browser js has same
problem) and for me the best solution is to pass from view as parameter
translated string as I don't see how we can use dynamic generated js elegant
and clean.

Put string as a parameter? No, this makes code really ugly!
Just untested idea: what about rename file.js into file.js.rb (which is
interpreted and strings are replaced) - is it valid to include script
with .js.rb instead of .js?

Best Regards,
Michal Zugec
Software developer
SuSE CR, s.r.o. e-mail: mzugec@xxxxxxx
Lihovarska 1060/12 tel: +420 284 028 960
190 00 Praha 9 fax: +420 296 542 374
Czech Republic

To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
List Navigation
Follow Ups