I tried the following code in different ways:
Correctly shows the translation to the detriment of others. But again, it brings the name of the collection .
import { Mongo } from "meteor/mongo";
export const ToRegister = new Mongo.Collection('ToRegister');
import SimpleSchema from 'simpl-schema';
SimpleSchema.setDefaultMessages({
initialLanguage: 'fa',
messages: {
en: {
required: '{{label}} is required',
minString: '{{label}} must be at least {{min}} characters',
maxString: '{{label}} cannot exceed {{max}} characters',
minNumber: '{{label}} must be at least {{min}}',
maxNumber: '{{label}} cannot exceed {{max}}',
minNumberExclusive: '{{label}} must be greater than {{min}}',
maxNumberExclusive: '{{label}} must be less than {{max}}',
minDate: '{{label}} must be on or after {{min}}',
maxDate: '{{label}} cannot be after {{max}}',
badDate: '{{label}} is not a valid date',
minCount: 'You must specify at least {{minCount}} values',
maxCount: 'You cannot specify more than {{maxCount}} values',
noDecimal: '{{label}} must be an integer',
notAllowed: '{{value}} is not an allowed value',
expectedType: '{{label}} must be of type {{dataType}}',
regEx: function ({
label,
type,
regExp,
}) {
// See if there's one where exp matches this expression
let msgObj;
if (regExp) {
msgObj = _.find(regExpMessages, (o) => o.exp && o.exp.toString() === regExp);
}
const regExpMessage = msgObj ? msgObj.msg : 'failed regular expression validation';
return `${label} ${regExpMessage}`;
},
keyNotInSchema: '{{name}} is not allowed by the schema',
},
fa: {
required: 'فیلد {{label}} اجباری است',
minString: 'فیلد {{label}} باید حداقل {{min}} نویسه باشد',
maxString: 'فیلد {{label}} باید حداکثر {{max}} نویسه باشد',
minNumber: 'فیلد {{label}} باید حداقل مقدار {{min}} دارا باشد',
maxNumber: 'فیلد {{label}} باید حداکثر مقدار {{max}} دارا باشد',
minNumberExclusive: '{{label}} باید be greater than {{min}}',
maxNumberExclusive: '{{label}} باید be less than {{max}}',
minDate: '{{label}} باید be on or after {{min}}',
maxDate: '{{label}} cannot be after {{max}}',
badDate: '{{label}} is not a valid date',
minCount: 'You باید specify at least {{minCount}} values',
maxCount: 'You cannot specify more than {{maxCount}} values',
noDecimal: '{{label}} باید be an integer',
notAllowed: '{{value}} is not an allowed value',
expectedType: '{{label}} باید be of type {{dataType}}',
regEx: function ({
label,
type,
regExp,
}) {
// See if there's one where exp matches this expression
let msgObj;
if (regExp) {
msgObj = _.find(regExpMessages, (o) => o.exp && o.exp.toString() === regExp);
}
const regExpMessage = msgObj ? msgObj.msg : 'failed regular expression validation';
return `${label} ${regExpMessage}`;
},
keyNotInSchema: '{{name}} is not allowed by the schema',
},
},
});
ToRegisterSchema = new SimpleSchema({
type : {
type: Number,
label:"حساب کاربری",
required : true,
max: 2,
min: 1,
}
});
ToRegister.attachSchema(ToRegisterSchema);