Skip to content

This NuGet package provides comprehensive country codes from around the globe, making it an essential tool for internationalization and localization in .NET projects

License

Notifications You must be signed in to change notification settings

Mwaseemzakir/Multiverse.Globalization

Repository files navigation

Multiverse

NuGet NuGet

Multiverse.Globalization is a .NET library for internationalization, providing support for languages, countries, and currencies.

Features

  • ISO 639-1 & ISO 639-2 language codes
  • ISO 3166-1 country codes
  • ISO 4217 currency codes
  • Validation, lookup, and retrieval
  • Complete global dataset

Installation

dotnet add package Multiverse

Usage

🌎 Language Handling

using Multiverse.Globalization.Languages;

// Get by identifier (e.g. "en", "eng", or "English")
var english = Language.GetLanguage("en");

// Validate identifier
bool isValid = Language.IsValid("fr"); // true

// Get all languages
var allLanguages = Language.GetAll();

Identifier: Name, Alpha2Code, Alpha3Code

🏳️ Country Handling

using Multiverse.Globalization.Countries;

// Get by identifier (e.g. "US", "USA", or "United States")
var usa = Country.GetCountry("US");

// Validate identifier
bool isValid = Country.IsValid("GB"); // true

// Get all countries
var allCountries = Country.GetAll();

Identifier: Name, Alpha2Code, Alpha3Code, NumericCode

💰 Currency Handling

using Multiverse.Globalization.Currencies;

// Get by identifier (e.g. "USD", 840, or "US Dollar")
var usd = Currency.GetCurrency("USD");
Console.WriteLine(usd.Name); // US Dollar
Console.WriteLine(usd.Symbol); // $

// Validate identifier
bool isValid = Currency.IsValid("EUR"); // true

// Get all currencies
var allCurrencies = Currency.GetAll();

Identifier: Name, Code, Number

Best Practices

Validate Before Use

if (Language.IsValid(identifier))
{
    var language = Language.GetLanguage(identifier);
}

Safe Lookups

var language = Language.GetLanguageOrDefault(identifier);

if (language != null)
{
    // Process language
}

Exception Handling

try
{
    var language = Language.GetLanguage(identifier);
}
catch (LanguageNotFoundException)
{
    // Handle missing language
}

About

This NuGet package provides comprehensive country codes from around the globe, making it an essential tool for internationalization and localization in .NET projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages