【问题标题】:Struggling with trans in a input placeholder在输入占位符中挣扎
【发布时间】:2018-01-11 21:13:46
【问题描述】:

这里是 HTML 部分

<div class="col-md-4 col-sm-4">
      <input type="text" class="form-control" placeholder={% trans "First Name" %} id="cf-fn" name="cf-fn" required="">
</div>

我得到的不是“名字”,而是“名字”。这是一张照片:

我该如何解决?

【问题讨论】:

    标签: django translation


    【解决方案1】:

    我从未使用过 django,但我认为这是一个 HTML 问题。

    尝试在双引号之间设置占位符值:

    <div class="col-md-4 col-sm-4">
          <input type="text" class="form-control" placeholder="{% trans "First Name" %}" id="cf-fn" name="cf-fn" required="">
    </div>
    

    如果没有双引号,浏览器只会将第一个单词作为占位符值,第二个单词用作另一个没有值的属性 (Name)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-08
      • 2023-04-06
      • 2014-08-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-13
      相关资源
      最近更新 更多