I had no experience about Babilu so I decided to go with the first
approach using filename.js.erb.
i) I created a new controller called js and moved all my translation-
needed *.js files under views/js and renamed them from *.js =>
*.js.erb
ii) Previously the *.js files were loaded from public/javascript, so I
needed to change this a bit. Now the moved *.js files are loaded from /
js/myclass.js
iii) And in my controller I'm also serving *.js files:
def index
respond_to do |format|
format.html
format.js
end
end
So basically I can now make translations like this:
// myclass.js
var MyClass = Class.create({
initialize: function() {
this.stringToBeTranslated = <%= I18n.t 'header.translate_me'
%>
}
});
But I have no idea if this is the right way. Comments?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---