如何在Rails中本地化file_field的标签? [英] How to localize the label of a file_field in Rails?

查看:204
本文介绍了如何在Rails中本地化file_field的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的应用程序中本地化表单,以便所有标签都使用芬兰语.使用所有其他表单组件,这很容易,但是如何使用文件字段来做到这一点呢?似乎总是在按钮上给我一个标签选择文件",并在按钮后立即给我一个标签没有选择文件".

I want to localize a form in my app so that all the labels are in Finnish. This is easy with all other form components, but how do I do this with a file field? It always seems to give me a label "choose file" in the button and "no file chosen" immediately after the button.

推荐答案

此哑文件字段仅取决于您的系统区域设置.您无法更改它的外观或行为方式,这使我们许多人感到烦恼,更不用说它在不同平台上看起来可能完全不同的事实.

This dumb file field depends only on your system locale. You cannot change way it looks or behaves, which annoys many of us, not to mention the fact that it can look completely different across different platforms.

要解决此问题,您可以选择以下选项:

To fight the problem you have options:

  1. 使用类似Flash的解决方案 SWFUpload等.
  2. 使用Javascript + CSS 解决方案(其中有很多, 例如这一个)
  1. use a flash solution like SWFUpload, etc.
  2. use a Javascript + CSS solution (there are many of them, e.g. this one)

这篇关于如何在Rails中本地化file_field的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆