Fix schema i18n by moving internationalize to collections

This commit is contained in:
saimeunt 2015-09-02 01:38:31 +02:00
parent 4a664538ff
commit c83a216ed1
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