2015-07-19 66 views
0

我找不到任何明显的指向自动表单标签来自望远镜的地方。的是,我可以看到(至少不会文章)的模式没有标签,没有什么明显的,至少在帖子自动窗体调用...望远镜表格标签 - 他们从哪里来?

{{> quickForm collection="Posts" id="submitPostForm" template="bootstrap3-horizontal" input-col-class="controls" type="method" meteormethod="submitPost" fields=postFields}} 

...我无法找到任何字段集或其他明显的方式将标签传递给自动表单。因此,作为一个例子,来自Posts模式的'createdAt'最终在表单中显示时具有'Created At'的显示标签 - 这种“转换”在哪里以及如何发生?

TIA!

回答

0

没关系......我找到了答案,挖掘更多的后...有附加处理这一模式之前延长SimpleSchema并称为国际化方法:

SimpleSchema.prototype.internationalize = function() { 
    var schema = this._schema; 

    _.each(schema, function (property, key) { 
    if (!property.label) { 
     schema[key].label = function() { 
     // if property is nested ("telescope.email"), only consider the last part ("email") 
     if (key.indexOf(".") !== -1) { 
      key = _.last(key.split(".")); 
     } 
     return i18n.t(key); 
     }; 
    } 
    }); 
    return this; 
}; 
0

表单标签使用的是国际化tap:i18n包。因此,您可以在各个包的/i18n目录中找到他们的翻译文件,其文件名为*.i18n.json