https://github.com/simplify9/sw-i18nservices
https://github.com/simplify9/sw-i18nservices
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/simplify9/sw-i18nservices
- Owner: simplify9
- License: mit
- Created: 2020-08-17T13:59:52.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-09-16T12:32:09.000Z (9 months ago)
- Last Synced: 2025-09-18T19:44:19.177Z (9 months ago)
- Language: C#
- Size: 2.21 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# SW.I18nServices
[](https://github.com/simplify9/SW-I18nServices/actions/workflows/nuget-publish.yml)
[](LICENSE)
[](https://www.nuget.org/packages/SimplyWorks.I18n.Service)
A comprehensive .NET library for internationalization (I18n) services including country data, currency conversion, and phone number validation.
## Features
### Countries Service
- Country information with ISO codes, names, and capitals
- Phone number formats and regex patterns
- Postal code formats and validation rules
- Currency information per country
- Language and top-level domain data
- Economic alliance information
### Currencies Service
- Complete currency information and codes
- Real-time currency conversion with external API integration
- Memory caching for exchange rates
- Support for all major world currencies
### Phone Numbering Plans Service
- Phone number validation by country
- Automatic formatting and normalization
- Mobile vs landline detection
- Area code validation
- International dialing code support
## Package
### SimplyWorks.I18n.Service
Core service components containing the business logic and data access layer.
**Key Models:**
- `Country` - Complete country information
- `Currency` - Currency data and codes
- `Pnp` (Phone Numbering Plan) - Phone validation rules
- `PnpResult` - Phone validation results
- `CurrencyRates` - Exchange rate data
**Key Services:**
- `CountriesService` - Country data retrieval and lookup
- `CurrenciesService` - Currency operations and conversion
- `PhoneNumberingPlansService` - Phone number validation
- `ExternalCurrencyRatesService` - Live exchange rate fetching
## Installation
```bash
dotnet add package SimplyWorks.I18n.Service
```
## Quick Start
```csharp
// Get country information
var countriesService = new CountriesService();
var country = countriesService.Get("US");
Console.WriteLine($"{country.Name} - {country.CurrencyCode}");
// Validate phone number
var phoneService = new PhoneNumberingPlansService(countriesService);
var result = phoneService.Validate("+1234567890", "US");
if (result.Status == PnpResultStatus.Ok)
{
Console.WriteLine($"Valid {result.PhoneType} phone number");
}
// Convert currency
var currenciesService = new CurrenciesService(/* dependencies */);
var converted = await currenciesService.ConvertAsync(100m, "USD", "EUR");
```
## Data Sources
The library includes embedded binary data files containing:
- `country.bin` - Country information database
- `cntryd.bin` - Country lookup data
- `pnpd.bin` - Phone numbering plan database
## Requirements
- .NET Standard 2.1
- Entity Framework Core (for service package)
- Memory caching support
## License
This project is licensed under the [MIT License](LICENSE).
---
## NuGet Package Description
### For SimplyWorks.I18n.Service
Comprehensive .NET internationalization services for country data lookup, real-time currency conversion, and phone number validation. Includes embedded databases for countries, currencies, and phone numbering plans with memory caching support. Provides country information with ISO codes, currency conversion with live exchange rates, and phone number validation with mobile/landline detection. For full documentation and examples, visit: https://github.com/simplify9/SW-I18nServices