Logo Lanfrica

binimuse/ethiopian_birr

Domaine:

natural language processing

Type de record:

software
Créateur:
bin
Hôte:
# ethiopian_birr Pure-Dart, zero-dependency formatting for Ethiopian Birr — the Amharic/Ethiopia-specific layer that `intl` doesn't cover. ```dart import 'package:ethiopian_birr/ethiopian_birr.dart'; void main() { print(Birr.toWords(1234.56)); // አንድ ሺህ ሁለት መቶ ሠላሳ አራት ብር ከሃምሳ ስድስት ሳንቲም } ``` Amount-in-words is the reason to install this package: it's needed for invoices, receipts, contracts, and cheques, and nothing else on pub.dev does it. Everything else — Amharic/Latin currency formatting, Ge'ez numerals, santim splitting, and parsing — supports that same use case. ## Why not just `intl`? `intl`'s `NumberFormat.currency` already formats ETB in Latin as `Br 1,234.56`. This package doesn't re-implement that. It fills in what `intl` structurally can't: 1. **Amharic-script currency output** — `ብር` instead of `Br`. 2. **Ge'ez numerals** — rendering whole-birr amounts with `፩፪፫`-style digits, using the classical additive numeral system. 3. **Amharic amount-in-words** — the headline feature above. The core is pure Dart with **zero runtime dependencies**. ## Installation ```yaml dependencies: ethiopian_birr: ^0.1.0 ``` ## Usage ### Amount in words ```dart Birr.toWords(1); // አንድ ብር Birr.toWords(0.56); // ሃምሳ ስድስት ሳንቲም Birr.toWords(100); // መቶ ብር Birr.toWords(1234.56); // አንድ ሺህ ሁለት መቶ ሠላሳ አራት ብር ከሃምሳ ስድስት ሳንቲም Birr.toWords(1000000); // አንድ ሚሊዮን ብር ``` ### Formatting ```dart Birr.format(1234.5); // Br 1,234.50 Birr.format(1234.5, format: BirrFormat.amharic); // 1,234.50 ብር Birr.format(1234.5, format: const BirrFormat( symbolPosition: SymbolPosition.after, )); // 1,234.50 ETB Birr.format(1234.5, format: const BirrFormat( grouping: false, decimalDigits: 0, )); // Br 1234 ``` `decimalDigits` is always derived from the same rounded santim value (via `Birr.split`), so different `decimalDigits` setti …