【发布时间】:2010-11-12 04:32:33
【问题描述】:
我正在为我的应用程序构建翻译,但我不知道如何翻译表单字段的默认标题。
特别是 file_form 标签。默认是生成一个带有标题“选择文件”的按钮和一个说明“未选择文件”的注释
这些翻译存在于 yml 中的什么位置?
【问题讨论】:
标签: ruby-on-rails-3 internationalization input translation
我正在为我的应用程序构建翻译,但我不知道如何翻译表单字段的默认标题。
特别是 file_form 标签。默认是生成一个带有标题“选择文件”的按钮和一个说明“未选择文件”的注释
这些翻译存在于 yml 中的什么位置?
【问题讨论】:
标签: ruby-on-rails-3 internationalization input translation
不幸的是, 以及它对用户的显示方式取决于浏览器,不可能有太多机会。
您可以找到几篇关于设置样式以使其看起来有点不同的文章,但是按钮本身和注释上的文本取决于用户正在运行的浏览器的语言,并且您无法更改它(至少我无法更改)找到)
【讨论】:
你最好使用引导文件上传。下面的代码适用于我的应用程序及其多语言
= transloadit :image_resize
-6.times do |index|
.fileupload.fileupload-new.pull-left{style: "padding-right: 5px;", "data-provides" => "fileupload" }
.fileupload-new.thumbnail{:style => "width: 130px; height: 130px;"}
-if @provider.provider_images.present?
- if @provider.provider_images["provider_image#{index+1}"].present?
%img{:id=>"providerimage1", :src => @provider.provider_images["provider_image#{index+1}"][0]}/
.fileupload-preview.fileupload-exists.thumbnail{:style => "width: 130px; height: 130px;"}
%div
%span.btn.btn-file
%span.fileupload-new{:id => "selectbutton"}
-if index == 0
=t('select_profile_image')
-else
=t('select_image')
%span.fileupload-exists
-if index == 0
=t('select_profile_image')
-else
=t('select_image')
=file_field_tag "provider_image#{index+1}"
【讨论】: