HTML输入文件 - 如何翻译“选择文件”和“无文件选择”? [英] HTML input file - how to translate "Choose File" and "No file Chosen"?

查看:311
本文介绍了HTML输入文件 - 如何翻译“选择文件”和“无文件选择”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于浏览器语言,我知道这两个字自动翻译。但是我的HTML没有这样做。



HTML:

 < p为H. 
< label for =id_company_logo>
公司标志:
< / label>
< input type =filename =company_logoid =id_company_logo/>
< / p>

它是从以下form代码生成的, django

  company_logo = forms.ImageField(label = _('Company Logo'),required = False,error_messages = {'invalid':_(Image files only)},widget = forms.FileInput)

我做错了吗?现在我搜索了一段时间,但我绝对没有运气。



提前感谢

解决方案

在Stackoverflow。

以下是文章:

如何更改输入类型=文件的按钮文本?

标签文件上传按钮

更改输入type =file中的默认文本?



但是这是一篇很棒的文章。



这里,您可以找到解决问题的解决方案。


I know that these two words get automatically translated, due to the browser language. But my HTML is not doing that.

HTML:

<p>
  <label for="id_company_logo">
     Company Logo:
  </label>
  <input type="file" name="company_logo" id="id_company_logo" />
</p>

It is generated from following "form" code of django:

company_logo = forms.ImageField(label=_('Company Logo'),required=False, error_messages = {'invalid':_("Image files only")}, widget=forms.FileInput)

Am I doing anything wrong? I searched around for some time now, but I had absolutely no luck.

Thanks in advance.

解决方案

This problem was disscused several times on Stackoverflow.
Here are the articles:
How to change the button text of input type="file" ?
Labeling file upload button
Change default text in input type="file"?

But this is a great article.

Here you can find a solution to your problem.

这篇关于HTML输入文件 - 如何翻译“选择文件”和“无文件选择”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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