<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace de.ahzf.Illias.Commons
{

    public struct German
    {

        public readonly String Text;

        public German(String myText)
        {
            Text = myText;
        }

        public override String ToString()
        {
            return Text;
        }

    }

    public struct English
    {

        public readonly String Text;

        public English(String myText)
        {
            Text = myText;
        }

        public override String ToString()
        {
            return Text;
        }

    }

    public struct I18N
    {

        public readonly English English;
        public readonly German  German;

        public I18N(English myEnglish)
        {
            English = myEnglish;
            German  = new German(myEnglish.Text);
        }

        public I18N(English myEnglish, German myGerman)
        {
            English = myEnglish;
            German  = myGerman;
        }

        public override String ToString()
        {
            return String.Concat(@"{ ""en"": """, English, @""", ""de"": """, German, @""" }");
        }

    }


    public static class I18NTools
    {

        public static String ToHTML(this I18N I18NValue)
        {

            return "<span class=\"english\">" + I18NValue.English.Text + "</span>" +
                   "<span class=\"german\">"  + I18NValue.German. Text + "</span>";

        }

        public static String ToHTML(this I18N I18NValue, String Prefix, String Postfix)
        {

            return "<span class=\"english\">" + Prefix + I18NValue.English.Text + Postfix + "</span>" +
                   "<span class=\"german\">"  + Prefix + I18NValue.German. Text + Postfix + "</span>";

        }

        #region AppendI18N(this StringBuilder, I18NValue)

        public static StringBuilder AppendI18N(this StringBuilder StringBuilder,
                                               I18N I18NValue)
        {
            return StringBuilder.Append(I18NValue.ToHTML());
        }

        #endregion

        #region AppendI18N(this StringBuilder, Prefix, I18NValue, Postfix)

        public static StringBuilder AppendI18N(this StringBuilder StringBuilder,
                                               String Prefix,
                                               I18N   I18NValue,
                                               String Postfix)
        {

            return StringBuilder.Append(Prefix).
                                 Append(I18NValue.ToHTML()).
                                 Append(Postfix);

        }

        #endregion

    }

}
<commit_msg>Added JSON output to I18NTools<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace de.ahzf.Illias.Commons
{

    public struct German
    {

        public readonly String Text;

        public German(String myText)
        {
            Text = myText;
        }

        public override String ToString()
        {
            return Text;
        }

    }

    public struct English
    {

        public readonly String Text;

        public English(String myText)
        {
            Text = myText;
        }

        public override String ToString()
        {
            return Text;
        }

    }


    public interface JSONString
    {
        String JSONString { get; }
    }

    public struct I18N : JSONString
    {

        public readonly English English;
        public readonly German  German;

        public I18N(English myEnglish)
        {
            English = myEnglish;
            German  = new German(myEnglish.Text);
        }

        public I18N(English myEnglish, German myGerman)
        {
            English = myEnglish;
            German  = myGerman;
        }

        public override String ToString()
        {
            return String.Concat("en: ", English, ", de:", German);
        }


        public String JSONString
        {
            get
            {
                return String.Concat(@"{ ""en"": """, English, @""", ""de"": """, German, @""" }");
            }
        }

    }


    public static class I18NTools
    {

        public static String ToHTML(this I18N I18NValue)
        {

            return "<span class=\"english\">" + I18NValue.English.Text + "</span>" +
                   "<span class=\"german\">"  + I18NValue.German. Text + "</span>";

        }

        public static String ToHTML(this I18N I18NValue, String Prefix, String Postfix)
        {

            return "<span class=\"english\">" + Prefix + I18NValue.English.Text + Postfix + "</span>" +
                   "<span class=\"german\">"  + Prefix + I18NValue.German. Text + Postfix + "</span>";

        }

        #region AppendI18N(this StringBuilder, I18NValue)

        public static StringBuilder AppendI18N(this StringBuilder StringBuilder,
                                               I18N I18NValue)
        {
            return StringBuilder.Append(I18NValue.ToHTML());
        }

        #endregion

        #region AppendI18N(this StringBuilder, Prefix, I18NValue, Postfix)

        public static StringBuilder AppendI18N(this StringBuilder StringBuilder,
                                               String Prefix,
                                               I18N   I18NValue,
                                               String Postfix)
        {

            return StringBuilder.Append(Prefix).
                                 Append(I18NValue.ToHTML()).
                                 Append(Postfix);

        }

        #endregion

    }

}

{'fraction_non_alphanumeric': 0.09151943462897527, 'fraction_numerical': 0.017314487632508833, 'mean_word_length': 1.377572448551029, 'pattern_counts': {'":': 4, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3593183', 'n_tokens_mistral': 1521, 'n_tokens_neox': 1404, 'n_words': 352}