Provides locale content for internationalisation software using the Unicode Common Local Data Repository (CLDR).
- Uses the official Unicode CLDR XML without any "build steps"
- Can download the latest CLDR anytime
- Uses XPath expressions to query the CLDR
- Parsing of a locale identifier
- Validation of common codes (language, currency, ...)
- Supports complex CLDR inheritance via
- Formatting of numbers and currency
- Spelling out cardinal and ordinal numbers
Published releases of the package are available on NuGet. To install, run the following command in the Package Manager Console.
PM> Install-Package Sepia.Globalization
using Sepia.Globalization;The CLDR uses the singleton pattern. To access the repository, use Cldr.Instance.
Ensure that the latest version of the CLDR is installed. This will download the latest published release from unicode.org, if required.
var version = Cldr.Instance.DownloadLatestAsync().Result;
Console.WriteLine($"Using CLDR {version}");Query the CLDR for the fractional digits of the Japanese Yen (JPY)
var jpy = Cldr.Instance
.GetDocuments("common/supplemental/supplementalData.xml")
.FirstElement("supplementalData/currencyData/fractions/info[@iso4217='JPY']");
Assert.AreEqual("0", jpy.Attribute("digits").Value);var locale = Locale.Create("fr");
var formatter = NumberFormatter.Create(locale);
Assert.AreEqual("1234,568", formatter.Format(1234.56789));Copyright © Richard Schneider (makaretu@gmail.com)
The library is licensed under the MIT license. Refere to the LICENSE file for more information.
