/// <summary> /// Gets the localized value. /// </summary> /// <param name="key">The resource key.</param> /// <param name="count">The number to specify the pluralization form.</param> /// <returns></returns> public string this[CultureDictionaryRecordKey key, int?count] { get { if (!Translations.TryGetValue(key, out var translations)) { return(null); } var pluralForm = count.HasValue ? PluralRule(count.Value) : 0; if (pluralForm >= translations.Length) { throw new PluralFormNotFoundException($"Plural form '{pluralForm}' doesn't exist for the key '{key}' in the '{CultureName}' culture.", new PluralForm(key, pluralForm, CultureInfo.GetCultureInfo(CultureName))); } return(translations[pluralForm]); } }
/// <summary> /// Gets the localized value. /// </summary> /// <param name="key">The resource key.</param> /// <returns></returns> public string this[CultureDictionaryRecordKey key] => this[key, null];