static private OnGetting__s ( System.Web.Mvc.MvcHtmlString defaultResult, |
||
defaultResult | System.Web.Mvc.MvcHtmlString | 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 | |
singularHTML | string | The HTML to be translated when count is 1 |
pluralHTML | string | The HTML to be translated when count is NOT 1 |
count | int | If count is 1 the singular HTML will be used, otherwise the plural text |
arguments | object | The arguments to be applied as arguments.Select(a => HttpUtility.HtmlEncode(a)) |
return | System.Web.Mvc.MvcHtmlString |
/// <summary> /// <para>@Alias <c>GetPluralHtml</c> and <c>FormatHtmlPlural</c></para> /// <para>Translates the given singular or plural HTML applying string.Format(html, arguments.Select(a => HttpUtility.HtmlEncode(a))) to the current culture language. </para> /// <para>The singular/plural HTML will be kept as it is, while arguments will be automatically HTML Encoded</para> /// </summary> /// <param name="culture">The culture being extended</param> /// <param name="singularHTML">The HTML to be translated when count is 1</param> /// <param name="pluralHTML">The HTML to be translated when count is NOT 1</param> /// <param name="count">If count is 1 the singular HTML will be used, otherwise the plural text</param> /// <param name="arguments">The arguments to be applied as arguments.Select(a => HttpUtility.HtmlEncode(a))</param> /// <returns>The translated formatted HTML as MvcHtmlString</returns> /// <created author="laurentiu.macovei" date="Fri, 06 Jan 2012 23:24:19 GMT"/> public static MvcHtmlString __s(this CultureInfo culture, string singularHTML, string pluralHTML, int count, params object[] arguments) { var result = new MvcHtmlString( (arguments == null || arguments.Length == 0) ? string.Format(count == 1 ? I18NComplete.GetText(singularHTML, lcid: culture.LCID) : I18NComplete.GetText(singularHTML, plural: true, lcid: culture.LCID), count) : string.Format(count == 1 ? I18NComplete.GetText(singularHTML, lcid: culture.LCID) : I18NComplete.GetText(singularHTML, plural: true, lcid: culture.LCID), new object[] { count }.Concat(arguments.Select(a => HttpUtility.HtmlEncode(a))).ToArray())); return (#if DEBUG I18NComplete.OnGetting__s(result, culture, singularHTML, pluralHTML, count, arguments) ?? #endif result); }