/// <summary> /// Make the specified str. /// Creates evaluator object. Returns null if failed to parse. /// </summary> /// <param name='str'> /// Text after "Plural-Forms:" (e.g. "nplurals=2; plural=(n != 1);"). /// </param> public static PluralFormsCalculator Make(string str) { if (String.IsNullOrEmpty(str)) { return(null); } if (str.EndsWith("\n")) { str = str.Remove(str.Length - 1, 1); } if (str.EndsWith("\\n")) { str = str.Remove(str.Length - 2, 2); } if (!str.EndsWith(";")) { str += ";"; } PluralFormsCalculator calculator = new PluralFormsCalculator(str); PluralFormsScanner scanner = new PluralFormsScanner(str); PluralFormsParser p = new PluralFormsParser(scanner); if (!p.Parse(calculator)) { return(null); } return(calculator); }
/// <summary> /// Make the specified str. /// Creates evaluator object. Returns null if failed to parse. /// </summary> /// <param name='str'> /// Text after "Plural-Forms:" (e.g. "nplurals=2; plural=(n != 1);"). /// </param> public static PluralFormsCalculator Make(string str) { if (String.IsNullOrEmpty(str)) return null; if (str.EndsWith("\n")) str = str.Remove(str.Length - 1, 1); if (str.EndsWith("\\n")) str = str.Remove(str.Length - 2, 2); if (!str.EndsWith(";")) str += ";"; PluralFormsCalculator calculator = new PluralFormsCalculator(str); PluralFormsScanner scanner = new PluralFormsScanner(str); PluralFormsParser p = new PluralFormsParser(scanner); if (!p.Parse(calculator)) { return null; } return calculator; }