number_to_words_english 3.0.0 copy "number_to_words_english: ^3.0.0" to clipboard
number_to_words_english: ^3.0.0 copied to clipboard

A comprehensive Flutter/Dart package that converts numbers to words with support for 12 languages including English, Vietnamese, Spanish, French, German, Italian, Portuguese, Russian, Chinese, Japanes [...]

ChangeLog #

3.0.0 - 2024-07-27 #

๐Ÿš€ Architecture Refactoring & Extension Methods + ๐Ÿฅ‡ Ordinal Numbers + ๐Ÿ’ฐ Currency Conversion #

๐Ÿ—๏ธ Modular Architecture

  • Separated language implementations: Each language now has its own dedicated file
    • lib/src/languages/english.dart - English implementation
    • lib/src/languages/vietnamese.dart - Vietnamese implementation
    • lib/src/languages/spanish.dart - Spanish implementation
  • Abstract base class: NumberToWordsLanguage provides common interface for all languages
  • Main API class: NumberToWords manages all language implementations
  • Clean exports: Main library file exports all public APIs with proper documentation

โœจ Extension Methods

  • num.toWords(): Convert any number to English words directly
  • Language-specific extensions:
    • num.toEnglish() - Convert to English
    • num.toVietnamese() - Convert to Vietnamese
    • num.toSpanish() - Convert to Spanish
    • num.toWordsInLanguage(String code) - Convert to any supported language
  • Integer-specific extensions:
    • int.toCardinal() - Cardinal number conversion
    • int.canConvertToWords() - Validation method
    • int.wordLength() - Get character count of word representation
    • int.wordCount() - Get word count of representation
  • Double-specific extensions:
    • double.toWordsWithDecimal() - Explicit decimal conversion
    • double.integerPartToWords() - Convert only integer part
    • double.decimalPartToWords() - Convert only decimal digits
  • String extensions:
    • String.toWordsFromString() - Convert number strings to words
    • String.isValidNumberString() - Validate number strings
    • String.toWordsInMultipleLanguages() - Convert to multiple languages at once

๐Ÿ”ง Advanced Features

  • Dynamic language registration: NumberToWords.registerLanguage()
  • Language introspection: NumberToWords.getLanguageInfo()
  • Direct language access: NumberToWords.getLanguage()
  • Runtime language management: Register/unregister languages dynamically

๐Ÿฅ‡ NEW: Ordinal Numbers Support

  • Full ordinal support: Convert numbers to ordinal form (1st, 2nd, 3rd, etc.) in all 12 languages
  • New API method: NumberToWords.convertOrdinal(languageCode, number)
  • Complete extension methods: toOrdinal(), toOrdinalVietnamese(), toOrdinalFrench(), etc.
  • Smart English ordinals: Proper irregular forms (first, second, third, eleventh, twelfth, twenty-first)
  • Integer-specific methods: toOrdinalWords(), getOrdinalSuffix(), canConvertToOrdinal()
  • Global coverage: All 12 languages support ordinal conversion with culturally appropriate forms

๐Ÿ’ฐ NEW: Currency Conversion Support

  • 12 major currencies: USD, EUR, GBP, JPY, VND, CNY, KRW, THB, SGD, AUD, CAD, CHF
  • New API method: NumberToWords.convertCurrency(languageCode, amount, currencyCode)
  • Currency extension methods: toCurrency(), toUSD(), toEUR(), toVND(), toCNY(), etc.
  • Multi-language currency names: Proper currency names in all 12 languages
  • Subunit handling: Automatic cents, pence, xu, jiao, etc. for appropriate currencies
  • No-decimal currencies: Special handling for JPY, KRW (no subunits)
  • Smart plural forms: Proper singular/plural currency names (dollar vs dollars)
  • Localized connectors: "and" (EN), "et" (FR), "y" (ES), "und" (DE), "ูˆ" (AR), etc.

๐Ÿ“š Enhanced Documentation

  • Comprehensive API documentation: Every method has detailed docs with examples
  • Library-level documentation: Clear usage guide in main library file
  • Migration guide: Step-by-step guide for upgrading from legacy API
  • Interactive example app: Showcases all new extension methods and APIs

๐Ÿงช Comprehensive Testing

  • 145 test cases: Complete coverage of all features including ordinals and currency
  • 15 new ordinal tests: Dedicated coverage for all ordinal functionality
  • 15 new currency tests: Complete currency conversion testing across all languages
  • Extension method tests: Dedicated test groups for each extension type
  • Architecture tests: Validation of modular design
  • Edge case handling: Robust error handling and validation

๐Ÿ“ฑ Example App Enhancements #

  • Extension methods demo: Interactive showcase of all extension methods
  • ๐Ÿ†• Ordinal numbers demo: Real-time ordinal conversion in all 12 languages
  • ๐Ÿ†• Currency conversion demo: Interactive currency conversion with all supported currencies
  • Real-time examples: Dynamic code examples that update with user input
  • Multi-API comparison: Side-by-side comparison of different APIs
  • Smart UI: Ordinals only shown for positive integers, currency shown for all numbers
  • Better UI: Modern Material Design 3 interface

๐Ÿ”„ Backward Compatibility #

  • 100% compatible: All existing code continues to work unchanged

  • Legacy API preserved: NumberToWordsEnglish class remains fully functional

  • Smooth migration path: Clear examples showing old vs new API usage

  • Zero breaking changes: Existing code requires no modifications

  • Smooth migration: Old API redirects to new English implementation

๐Ÿ—๏ธ Architecture Improvements #

  • Abstract base class: NumberToWordsLanguage for extensible language support
  • Modular design: Separate implementations for each language
  • Performance optimized: Efficient number processing algorithms
  • Well tested: 59 comprehensive test cases covering all languages

๐Ÿ“š Documentation & Examples #

  • Updated README: Comprehensive multi-language examples and API documentation
  • Example app: Interactive demo showcasing all supported languages
  • Migration guide: Clear instructions for upgrading from legacy API

๐Ÿงช Testing #

  • 59 test cases: Covering all languages, edge cases, and API compatibility
  • Language-specific tests: Validation of number conversion rules for each language
  • Backward compatibility tests: Ensures legacy API continues to function

2.1.0 #

  • [new] Update support for large integers up to quintillion.

2.0.2 #

  • fix ios build error

2.0.1 #

  • fix formatting issues

0.0.3 #

  • update changelog

0.0.2 #

  • Readme fixes

0.0.1 #

  • Initial release
37
likes
0
points
4.05k
downloads

Publisher

unverified uploader

Weekly Downloads

A comprehensive Flutter/Dart package that converts numbers to words with support for 12 languages including English, Vietnamese, Spanish, French, German, Italian, Portuguese, Russian, Chinese, Japanese, Dutch, and Arabic.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on number_to_words_english