Merge pull request #1115 from saimeunt/master

Fix schema i18n by moving internationalize to collections
This commit is contained in:
Sacha Greif 2015-09-04 11:32:29 +09:00
commit 93232aa639
2 changed files with 6 additions and 4 deletions

View file

@ -40,9 +40,8 @@ i18n.t = function (str, options) {
}
};
SimpleSchema.prototype.internationalize = function () {
var schema = this._schema;
Mongo.Collection.prototype.internationalize = function(){
var schema = this.simpleSchema()._schema;
_.each(schema, function (property, key) {
if (!property.label) {
schema[key].label = function () {

View file

@ -226,7 +226,10 @@ Posts.schema = new SimpleSchema({
});
// schema transforms
Posts.schema.internationalize();
Meteor.startup(function(){
// needs to happen after every fields were added
Posts.internationalize();
});
/**
* Attach schema to Posts collection