public EnglishPluralityStringNormaliser(IEnumerable <PluralEntry> plurals, IStringNormaliser optionalPreNormaliser, PreNormaliserWorkOptions preNormaliserWork) { if (plurals == null) { throw new ArgumentNullException("pluralEntries"); } var allPreNormaliserOptions = (PreNormaliserWorkOptions)0; foreach (PreNormaliserWorkOptions option in Enum.GetValues(typeof(PreNormaliserWorkOptions))) { allPreNormaliserOptions = allPreNormaliserOptions | option; } if ((preNormaliserWork & allPreNormaliserOptions) != preNormaliserWork) { throw new ArgumentOutOfRangeException("preNormaliserWork"); } var pluralsTidied = new List <PluralEntry>(); foreach (var plural in plurals) { if (plural == null) { throw new ArgumentException("Null reference encountered in plurals set"); } pluralsTidied.Add(plural); } // Although we don't need the plurals once the normaliser has been generated in normal operation, if the instance is to be serialised then we need to record // them so that the normalier can be re-generated at deserialisation (as the normaliser that is generated can not be serialised - see GetObjectData) _plurals = pluralsTidied; _normaliser = GenerateNormaliser(); _optionalPreNormaliser = optionalPreNormaliser; _preNormaliserWork = preNormaliserWork; }
public EnglishPluralityStringNormaliser(IStringNormaliser optionalPreNormaliser, PreNormaliserWorkOptions preNormaliserWork) : this(DefaultPlurals, optionalPreNormaliser, preNormaliserWork) { }