Example #1
0
        public TranslationWriter(
            ITranslationFormatter formatter,
            string indent,
            int estimatedSize)
        {
            _formatter = formatter ?? NullTranslationFormatter.Instance;
            _indent    = indent;
#if DEBUG && NET40
            _estimatedSize = estimatedSize;
#endif
            _content = new StringBuilder(estimatedSize);
        }
        internal static string GetFriendlyName(
            this Type type,
            TranslationSettings translationSettings,
            ITranslationFormatter formatter)
        {
            var writer = new TranslationWriter(
                formatter,
                translationSettings.Indent,
                (type.FullName ?? type.ToString()).Length);

            writer.WriteFriendlyName(type, translationSettings);

            return(writer.GetContent());
        }
 /// <summary>
 /// Format translations using the given <paramref name="formatter"/>.
 /// </summary>
 /// <param name="formatter">
 /// The <see cref="ITranslationFormatter"/> with which to format translations.
 /// </param>
 /// <returns>These <see cref="TranslationFormattingSettings"/>, to support a fluent API.</returns>
 public TranslationFormattingSettings FormatUsing(ITranslationFormatter formatter)
 {
     _wrappedSettings.FormatUsing(formatter);
     return(this);
 }
Example #4
0
 /// <summary>
 /// Format Expression translations using the given <paramref name="formatter"/>.
 /// </summary>
 /// <param name="formatter">
 /// The <see cref="ITranslationFormatter"/> with which to format Expression translations.
 /// </param>
 /// <returns>These <see cref="TranslationSettings"/>, to support a fluent API.</returns>
 public TranslationSettings FormatUsing(ITranslationFormatter formatter)
 {
     Formatter = formatter;
     return(this);
 }