static private OnGetting_s ( string defaultResult, |
||
defaultResult | string | The I18NComplete default result. Returning null will fallback on this result, otherwise return a custom value to oveerride this. |
culture | The culture this translation is being translated | |
singular | string | The text to be translated when count is 1 |
plural | string | The text to be translated when count is NOT 1 |
count | int | If count is 1 the singular text will be used, otherwise the plural text |
return | string |
/// <summary> /// <para>@Alias <c>GetPluralString</c> and <c>FormatPlural</c></para> /// <para>Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language. </para> /// <para>The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC</para> /// </summary> /// <param name="culture">The culture being extended</param> /// <param name="singular">The text to be translated when count is 1</param> /// <param name="plural">The text to be translated when count is NOT 1</param> /// <param name="count">If count is 1 the singular text will be used, otherwise the plural text</param> /// <param name="arguments">Custom arguments list to be passed to string.Format</param> /// <returns>The translated formatted text as string</returns> /// <created author="laurentiu.macovei" date="Fri, 06 Jan 2012 23:21:19 GMT"/> public static string _s(this CultureInfo culture, string singular, string plural, int count, params object[] arguments) { var result = ((arguments == null || arguments.Length == 0) ? string.Format(count == 1 ? I18NComplete.GetText(singular, lcid: culture.LCID) : I18NComplete.GetText(singular, plural: true, lcid: culture.LCID), count) : string.Format(count == 1 ? I18NComplete.GetText(singular, lcid: culture.LCID) : I18NComplete.GetText(singular, plural: true, lcid: culture.LCID), new object[] { count }.Concat(arguments).ToArray())); return (#if DEBUG I18NComplete.OnGetting_s(result, culture, singular, plural, count, arguments) ?? #endif result); }