public static string Convert(decimal number, Currency currency = Currency.NONE, bool stems = false)
        {
            var options = new NumberToTextOptions
            {
                Stems    = stems,
                Currency = currency,
            };

            return(CommonConvert(PrepareNumbers(number), options));
        }
        private static string CommonConvert(IEnumerable <int> numbers, NumberToTextOptions options)
        {
            var algorithm = GetAlgorithm(options.Currency);

            algorithm.Dictionaries = options.Dictionary ?? _kernel.Get <IDictionaries>();
            algorithm.Numbers      = numbers;
            algorithm.Options      = options;

            return(algorithm.Build());
        }
        public static string Convert(long number, Currency currency = Currency.NONE, bool stems = false)
        {
            var options = new NumberToTextOptions
            {
                Stems    = stems,
                Currency = currency,
            };

            return(CommonConvert(new[] { number }, options));
        }
        private static string CommonConvert(IEnumerable <long> numbers, NumberToTextOptions options)
        {
            var currencyDeflation = CurrencyDeflationFactory.GetCurrencyDeflation(options.Currency);

            var dictionary = options.Dictionary;

            if (dictionary == null)
            {
                dictionary = options.Stems
                    ? new PolishWithsStemsDictionary()
                    : (ICurrencyDictionary) new PolishDictionary();
            }

            var algorithm = new CurrencyAlgorithm(dictionary, currencyDeflation, options.SplitDecimal, options.Stems);

            return(algorithm.Build(numbers));
        }
 public static string Convert(decimal number, NumberToTextOptions options)
 {
     return(CommonConvert(PrepareNumbers(number), options));
 }
 public static string Convert(int number, NumberToTextOptions options)
 {
     return(CommonConvert(new[] { number }, options));
 }
 public static string Convert(int number, NumberToTextOptions options)
 {
     return(Convert((long)number, options));
 }