Class Cldr
Provides access to the Unicode Common Local Data Repository (CLDR).
Inherited Members
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 SourceCldr()
Create a new instance of CLDR.
Declaration
protected Cldr()
Remarks
Clrd implements the Singleton Pattern. Use the Instance property.
Fields
| Improve this Doc View SourceInstance
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.
OriginUrl
The official source for CLDR data.
Declaration
public static string OriginUrl
Field Value
Type | Description |
---|---|
String |
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 SourceCurrentVersion()
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
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. |
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().
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 |
Remarks
Each Repositories is searched for
for the document name
.
If no document is found, an empty sequence is returned.
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 |
Remarks
Each Repositories is searched for
for the document name
.
Exceptions
Type | Condition |
---|---|
FileNotFoundException | When no document with the |
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 |
Remarks
Each Repositories is searched for
for the document name
.
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 |
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 |
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 |
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 |
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 |
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.