Show / Hide Table of Contents

Class Rule

A plural rule.

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

Properties

| Improve this Doc View Source

Category

Gets the plural category for the rule.

Declaration
public string Category { get; }
Property Value
Type Description
String

"zero", "one", "two", "few", "many" or "other".

| Improve this Doc View Source

Samples

Some examples that match.

Declaration
public string Samples { get; }
Property Value
Type Description
String
| Improve this Doc View Source

Text

The textual representation of the expression to evaluate.

Declaration
public string Text { get; }
Property Value
Type Description
String

Methods

| Improve this Doc View Source

ConvertExpression(String)

Convert a Unicode plural rule expression into a NCalc expression.

Declaration
public static string ConvertExpression(string s)
Parameters
Type Name Description
String s

A plural rule expression.

Returns
Type Description
String

The NCalc equivalent.

Remarks

Internal method.

| Improve this Doc View Source

Matches(RuleContext)

Determines if the rule matches the RuleContext.

Declaration
public bool Matches(RuleContext context)
Parameters
Type Name Description
RuleContext context

The context.

Returns
Type Description
Boolean

true if the rule matches the context.

| Improve this Doc View Source

Parse(String, String)

Create a rule from the specified Category and rule.

Declaration
public static Rule Parse(string category, string s)
Parameters
Type Name Description
String category

"zero", "one", "two", "few", "many" or "other".

String s

The Text and/or Samples

Returns
Type Description
Rule

A new rule.

| Improve this Doc View Source

Parse(XPathNavigator)

Create a rule from the specified XPathNavigator.

Declaration
public static Rule Parse(XPathNavigator xml)
Parameters
Type Name Description
XPathNavigator xml

The XML representation of a plural rule.

Returns
Type Description
Rule

A new rule.

Remarks

The xml must be on an "pluralRule" element.

See Also

http://unicode.org/reports/tr35/tr35-numbers.html#Plural_rules_syntax
  • Improve this Doc
  • View Source
Back to top Generated by DocFX