public SimoPluralizer()
 {
     _specificPluralizations = new Dictionary<string, string>();
     _service = PluralizationService.CreateService(new CultureInfo("en"));
     IsEnabled = true;
     InitializeSpecificPluralizations();
 }
 private ThesaurusConverter()
 {
     var words = (string)new ResourceManager("Smartifyer.Resources", GetType().Assembly).GetObject("Words");
     ValidWords = words.Split(new[] { "\n","\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();
     db = new SmartifyerContext();
     _dependency = typeof(System.Data.Entity.SqlServer.SqlProviderServices);
     Parser = new StanfordParsingService();
     Pluralizer = PluralizationService.CreateService(CultureInfo.GetCultureInfo("en-US"));
 }
        /// <summary>
        /// </summary>
        /// <param name="extraPluralizationWords">
        ///     A string containing extra pluralization words
        ///     in the form Singular1,Plural1|Singular2,Plural2|Singular3,Plural3 ...
        /// </param>
        public DefaultConvention(IEnumerable<KeyValuePair<string, string>> extraPluralizationWords) {
            this.pluralizer = PluralizationService.CreateService(new CultureInfo("en-GB"));

            // ok, damned EnglishPluralizationService is an internal class so bit of reflection...
            var addWordMethod =
                typeof(PluralizationService).Assembly.GetType("System.Data.Entity.Design.PluralizationServices.EnglishPluralizationService")
                                            .GetMethod("AddWord");

            if (extraPluralizationWords != null) {
                try {
                    foreach (var pair in extraPluralizationWords) {
                        addWordMethod.Invoke(this.pluralizer, new object[] { pair.Key, pair.Value});
                    }
                }
                catch (Exception e) {
                    throw new Exception("At the moment only English pluralization is supported", e);
                }
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="extraPluralizationWords">
        ///     A string containing extra pluralization words
        ///     in the form Singular1,Plural1|Singular2,Plural2|Singular3,Plural3 ...
        /// </param>
        public DefaultConvention(string extraPluralizationWords) {
            this.pluralizer = PluralizationService.CreateService(new CultureInfo("en-GB"));

            // ok, damned EnglishPluralizationService is an internal class so bit of reflection...
            var addWordMethod =
                typeof(PluralizationService).Assembly.GetType("System.Data.Entity.Design.PluralizationServices.EnglishPluralizationService")
                                            .GetMethod("AddWord");

            if (!string.IsNullOrWhiteSpace(extraPluralizationWords)) {
                try {
                    var pairs = extraPluralizationWords.Split('|');

                    foreach (var pair in pairs) {
                        var words = pair.Split(',');
                        if (words.Length == 2) {
                            addWordMethod.Invoke(this.pluralizer, new object[] { words[0], words[1] });
                        }
                    }
                }
                catch (Exception e) {
                    throw new Exception("At the moment only English pluralization is supported", e);
                }
            }
        }
 static StringExtensions()
 {
     // Pluralization service currently only supports English, if other languages are supported in the
     // future, cached services can use to a concurrent dictionary keyed on LCID of culture
     s_pluralizationService = PluralizationService.CreateService(CultureInfo.GetCultureInfo("en-us"));
 }
Exemple #6
0
		public PluralizeProxy(PluralizationService pluralizer)
		{
			_pluralizer = pluralizer;
		}
 public DefaultConvention() {
     this.pluralizationService = PluralizationService.CreateService(new CultureInfo("en-gb"));
 }
 /// <summary>
 /// Handler for pluralization service in Entity Design
 /// </summary>
 /// <param name="doPluralization">overall switch for the service, the service only start working when the value is true</param>
 /// <param name="userDictionaryPath"></param>
 /// <param name="errors"></param>
 internal EntityDesignPluralizationHandler(PluralizationService service)
 {
     this.Service = service;
 }
Exemple #9
0
 /// <summary>
 /// Handler for pluralization service in Entity Design
 /// </summary>
 internal EntityDesignPluralizationHandler(PluralizationService service)
 {
     this.Service = service;
 }
		/// <summary>
		/// Initializes the convention with a custom pluralizer and resource format.
		/// </summary>
		public PluralizerResourceConvention(PluralizationService pluralizer, PluralizerResourceFormat resourceFormat)
		{
			this.pluralizer = pluralizer;
			this.format = resourceFormat;
		}
 static XElementExtensions()
 {
     pluralizationService = PluralizationService.CreateService(CultureInfo.CurrentCulture);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="DefaultConvention" /> class.
 /// </summary>
 /// <param name="stringLength">
 ///     The string length.
 /// </param>
 /// <param name="decimalPrecision">
 ///     The decimal precision.
 /// </param>
 /// <param name="decimalScale">
 ///     The decimal scale.
 /// </param>
 public DefaultConvention(ushort stringLength = 255, byte decimalPrecision = 18, byte decimalScale = 10) {
     this.stringLength = stringLength;
     this.decimalPrecision = decimalPrecision;
     this.decimalScale = decimalScale;
     this.Pluralizer = PluralizationService.CreateService(new CultureInfo("en-GB")); // <-- Americans, back in your box.
 }
 static GrammerExtensions()
 {
     Pluralizer = PluralizationService.CreateService(new CultureInfo("en-US"));
 }
 public Microcloud(string endpoint)
 {
     // FIXME hardcoded endpoint
     this._client = new RestClient(endpoint);
     this.ps = PluralizationService.CreateService(CultureInfo.GetCultureInfo("en-us"));
 }
 public ProductElementDictionaryConverter(PluralizationService pluralizationService)
 {
     dictionary = new Dictionary<string, string>();
     this.pluralization = pluralizationService;
 }
Exemple #16
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     Task.Factory.StartNew(LoadTables);
     Task.Factory.StartNew(LoadViews);
     tbPath.Text = Path.Combine(Environment.CurrentDirectory, "Output");
     _PluralizationSvc = PluralizationService.CreateService(CultureInfo.GetCultureInfo("en-us"));
     tbDefaultNamespace.Text = ConfigurationManager.AppSettings["defaultNamespace"];
 }