Restores the built-in pluralization rule for every language.
Refills PluralRules.IsoLangToDelegate with only the built-in rules, which discards every rule you added or
replaced. A change to PluralRules.IsoLangToDelegate applies to all formatting in the project, so call this
method once you no longer need your custom rules, for example at the end of a test that registers one.
Additional resources: PluralRules.IsoLangToDelegate, PluralRules.GetPluralRule
using System.Globalization; using Unity.SmartStrings; using Unity.SmartStrings.Utilities; using UnityEngine;
public static class CustomPluralRuleExample { public static void FormatWithCustomRule() { var english = CultureInfo.GetCultureInfo("en");
// Use the first plural word for every count while the custom rule is registered. PluralRules.IsoLangToDelegate["en"] = (value, pluralWordsCount) => 0;
try { Debug.Log(Smart.Format(english, "{0} {0:plural:item|items}", 5)); // 5 item } finally { PluralRules.RestoreDefault(); }
Debug.Log(Smart.Format(english, "{0} {0:plural:item|items}", 5)); // 5 items } }