Class Rule
A plural rule.
Inherited Members
Namespace: Sepia.Globalization.Plurals
Assembly: Sepia.Globalization.dll
Syntax
public class Rule
Properties
| Improve this Doc View SourceCategory
Gets the plural category for the rule.
Declaration
public string Category { get; }
Property Value
Type | Description |
---|---|
String | "zero", "one", "two", "few", "many" or "other". |
Samples
Some examples that match.
Declaration
public string Samples { get; }
Property Value
Type | Description |
---|---|
String |
Text
The textual representation of the expression to evaluate.
Declaration
public string Text { get; }
Property Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceConvertExpression(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.
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 |
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 |
Returns
Type | Description |
---|---|
Rule | A new rule. |
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.