Show / Hide Table of Contents

Class Cldr

Provides access to the Unicode Common Local Data Repository (CLDR).

Inheritance
Object
Cldr
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Sepia.Globalization
Assembly: Sepia.Globalization.dll
Syntax
public class Cldr
Remarks

CLDR implements the singleton pattern. All access to the CLDR is via the Instance property.

Constructors

| Improve this Doc View Source

Cldr()

Create a new instance of CLDR.

Declaration
protected Cldr()
Remarks

Clrd implements the Singleton Pattern. Use the Instance property.

Fields

| Improve this Doc View Source

Instance

The instance of the CLDR.

Declaration
public static Cldr Instance
Field Value
Type Description
Cldr

Provides access to the Unicode CLDR.

Remarks

CLDR implements the singleton pattern. All access to CLDR is via this property.

| Improve this Doc View Source

OriginUrl

The official source for CLDR data.

Declaration
public static string OriginUrl
Field Value
Type Description
String

http://unicode.org/Public/cldr/

| Improve this Doc View Source

Repositories

Local sources for CLDR data.

Declaration
public List<string> Repositories
Field Value
Type Description
List<String>

The folder(s) that may contain CLDR files.

Remarks

Sometimes the user or an app developer may want to add/change CLDR data supplied by Unicode. This is a list of directories to search for the CLDR data.

It is initially set to the repo provided by Unicode. To add your overrides insert the path at the head of list.

Methods

| Improve this Doc View Source

CurrentVersion()

Gets the current, locally cached, version of the CLDR.

Declaration
public Version CurrentVersion()
Returns
Type Description
Version

If the CLDR is not locally cached, then "0.0.0" is returned.

Remarks

The version number is defined in common/dtd/ldml.dtd

| Improve this Doc View Source

DownloadAsync(Version)

Downloads the specified CLDR Version to the current, locally cached, copy.

Declaration
public Task<string[]> DownloadAsync(Version version)
Parameters
Type Name Description
Version version

The CLDR version to use locally.

Returns
Type Description
Task<String[]>

The local paths to the downloaded files.

| Improve this Doc View Source

DownloadLatestAsync()

Downloads the latest version of CLDR.

Declaration
public Task<Version> DownloadLatestAsync()
Returns
Type Description
Task<Version>

The latest published version number.

Remarks

Only performs a download when the CurrentVersion() is less than the LatestVersionAsync().

| Improve this Doc View Source

GetAllDocuments(String)

Gets all the CLDR XML document(s) with the specified name, non-existent documents are ignored.

Declaration
public IEnumerable<XPathDocument> GetAllDocuments(string name)
Parameters
Type Name Description
String name

The SVN trunk relative name of the document, such as "common/main/EN_US.xml".

Returns
Type Description
IEnumerable<XPathDocument>

A sequence of XPathDocuments that match the name.

Remarks

Each Repositories is searched for for the document name.

If no document is found, an empty sequence is returned.

| Improve this Doc View Source

GetDocuments(String)

Gets the CLDR XML document(s) with the specified name.

Declaration
public IEnumerable<XPathDocument> GetDocuments(string name)
Parameters
Type Name Description
String name

The SVN trunk relative name of the document, such as "common/supplemental/supplementalData.xml".

Returns
Type Description
IEnumerable<XPathDocument>

A sequence of XPathDocuments that match the name.

Remarks

Each Repositories is searched for for the document name.

Exceptions
Type Condition
FileNotFoundException

When no document with the name exists.

| Improve this Doc View Source

GetTextDocuments(String)

Gets the CLDR text document(s) with the specified name.

Declaration
public IEnumerable<StreamReader> GetTextDocuments(string name)
Parameters
Type Name Description
String name

The SVN trunk relative name of the document, such as "common/dtd/ldml.dtd".

Returns
Type Description
IEnumerable<StreamReader>

A sequence of StreamReaders that match the name.

Remarks

Each Repositories is searched for for the document name.

| Improve this Doc View Source

IsCurrencyDefined(String)

Determines if the currency code is defined.

Declaration
public bool IsCurrencyDefined(string code)
Parameters
Type Name Description
String code

The currency code to check.

Returns
Type Description
Boolean

true if the code is defined; otherwise, false.

| Improve this Doc View Source

IsLanguageDefined(String)

Determines if the language code is defined.

Declaration
public bool IsLanguageDefined(string code)
Parameters
Type Name Description
String code

The language code to check.

Returns
Type Description
Boolean

true if the code is defined; otherwise, false.

| Improve this Doc View Source

IsRegionDefined(String)

Determines if the region code is defined.

Declaration
public bool IsRegionDefined(string code)
Parameters
Type Name Description
String code

The region code to check.

Returns
Type Description
Boolean

true if the code is defined; otherwise, false.

| Improve this Doc View Source

IsScriptDefined(String)

Determines if the script code is defined.

Declaration
public bool IsScriptDefined(string code)
Parameters
Type Name Description
String code

The script (writting system) code to check.

Returns
Type Description
Boolean

true if the code is defined; otherwise, false.

| Improve this Doc View Source

IsVariantDefined(String)

Determines if the language variant code is defined.

Declaration
public bool IsVariantDefined(string code)
Parameters
Type Name Description
String code

The language variant code to check.

Returns
Type Description
Boolean

true if the code is defined; otherwise, false.

| Improve this Doc View Source

LatestVersionAsync()

Gets the latest published version number from unicode.org.

Declaration
public static Task<Version> LatestVersionAsync()
Returns
Type Description
Task<Version>
Remarks

The latest version number is obtained by doing a "GET http://www.unicode.org/Public/cldr/latest"; and retrieving the Location header for the re-direct.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX