Giter Site home page Giter Site logo

net-cldr's Introduction

Sepia.Globalization

build status travis build Coverage Status NuGet docs

Provides locale content for internationalisation software using the Unicode Common Local Data Repository (CLDR).

Features

Getting started

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

Usage

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

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);

Format

var locale = Locale.Create("fr");
var formatter = NumberFormatter.Create(locale);

Assert.AreEqual("1234,568", formatter.Format(1234.56789));

License

Copyright © Richard Schneider ([email protected])

The library is licensed under the MIT license. Refere to the LICENSE file for more information.

Buy Me A Coffee

net-cldr's People

Contributors

richardschneider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

net-cldr's Issues

Compact numbers

The Numeric Formatter does not allow the long/short compact representation; such as 1000 being "1K".

Using Transforms

@richardschneider that is not bug, sorry for this. But I am so new using CLDR and slogging to understand. I have a project which was writing .NET. I found your .NET wrapper. So my question is about this http://cldr.unicode.org/translation/transforms page. I would like to transform Chinese or Japanese or Russian or Greek person name to roman writing. For example;

キャンパス -> kyanpasu
Αλφαβητικός Κατάλογος -> Alphabētikós Katálogos
биологический -> biologicheskij

Thank you in advance

Missing number grouping for small numbers

Hello,
it looks like a number grouping functionality works incorrectly in the edge case:

var version = await Cldr.Instance.DownloadLatestAsync(); // version: 38.0

var locale = Locale.Create("en"); // locale: en-Latn-US
var formatter = NumberFormatter.Create(locale); // formatter.Options.UseGrouping: true, formatter.Symbols.Group: ","

Console.WriteLine($"{formatter.Format(1000)}");

For en-Latn-US locale minimumGroupingDigits is 1 and decimalFormat pattern is #,##0.###.
So according to Numbering Systems and Number and currency patterns docs, 1,000 must be printed out, but 1000 is printed instead.

I guess the problem is here:

useGrouping = nDigits > minDigits;

should be

useGrouping = nDigits >= minDigits;

Please check, maybe I misunderstood the docs.

String ranges

String Ranges needs to be fully implemented. It currently only supports a special test.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.