System.Globalization.I18N._s C# (CSharp) 메소드

_s() 공개 정적인 메소드

@Alias GetPluralString and FormatPlural

Translates the given singular or plural text applying string.Format(text, arguments) to the current culture language.

The singular/plural text and argument values will be HTML Encoded when used in ASP.NET MVC

public static _s ( this culture, string singular, string plural, int count ) : string
culture this The culture being extended
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
리턴 string
        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;
        }