开发者

Ruby on rails - javascript current locale

开发者 https://www.devze.com 2023-01-19 17:30 出处:网络
How a javascript can get the current locale in ruby on rail开发者_JS百科s application?There are few ways how to do it, for example you can set locale variable in your view like this:

How a javascript can get the current locale in ruby on rail开发者_JS百科s application?


There are few ways how to do it, for example you can set locale variable in your view like this:

<script type="text/javascript"> 
  var locale = '<%= I18n.locale %>';
</script>

Of course, this is a global variable, so you should use a namespace.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号