简体   繁体   English

在Rails中翻译JS文件中的“正在加载...”一词

[英]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. 我想将这个“正在加载...”一词翻译成法语,但我无法做到,因为其链接在.Js文件中。

How can i translate this word??? 我该如何翻译这个词??? in my file grid-locale-en.js 在我的文件grid-locale-en.js中

(function(a){a.jgrid={defaults:{recordtext:"View {0} - {1} of {2}",emptyrecords:"No records to view",loadtext:"Loading...",pgtext:"Page {0} of {1}"},......)

Can anybody help me plzz 谁能帮助我

将javascript内联插入您的javascript中(如果您只有几个)可能是有意义的。

var loading_trans = <%= t :loading %>;

You seem to need some client-side localization. 您似乎需要一些客户端本地化。

There are many plugins to handle just that: 有许多插件可以处理这些问题:

http://plugins.jquery.com/plugin-tags/i18n http://plugins.jquery.com/plugin-tags/i18n

I think this is what you need: I18n in Javascript files with Rails 3 . 我认为这就是您所需要的: 使用Rails 3的Javascript文件中的I18n

Ger GER

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. 就像您说的那样,您有一个名为grid-locale-en.js的文件是您自己制作的,还是该框架的一部分。

if it is the latter, i assume you could just go ahead and make a grid-locale-fr.js for french for example? 如果是后者,我认为您可以继续进行操作,例如为法语制作grid-locale-fr.js吗? translate all strings in there. 翻译那里的所有字符串。

however this is just my assumption on the file name you already use. 但是,这只是我对您已经使用的文件名的假设。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM