Translating "Loading..." word from JS file in rails
When i click on Grid to view my list items then there is message "Loading..." shows up during the loading of the items into the Grid. I want to translate this "Loading..." word into french but i cant do it because its linked in .Js file.
How can i translate this word??? in my file grid-locale-en.js
(function(a){a.jgrid={defaults:{recordtext:"View {0} - {1} of {2}",emptyrecords:"No records to 开发者_Python百科view",loadtext:"Loading...",pgtext:"Page {0} of {1}"},......)
Can anybody help me plzz
You seem to need some client-side localization.
There are many plugins to handle just that:
http://plugins.jquery.com/plugin-tags/i18n
as you say you have a file called grid-locale-en.js is this something you made yourself, or is this part of the framework.
if it is the latter, i assume you could just go ahead and make a grid-locale-fr.js for french for example? translate all strings in there.
however this is just my assumption on the file name you already use.
I think this is what you need: I18n in Javascript files with Rails 3.
Ger
It may make sense to put the javascript translations inline into your javascript (if you only have a couple ones).
var loading_trans = <%= t :loading %>;
精彩评论