How to localize the label of a file_field in Rails?

a 夏天 提交于 2020-01-17 08:17:27

问题


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.


回答1:


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. use a flash solution like SWFUpload, etc.
  2. use a Javascript + CSS solution (there are many of them, e.g. this one)


来源:https://stackoverflow.com/questions/2317049/how-to-localize-the-label-of-a-file-field-in-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!