Transliterating Tatar To Cyrillic Input :

&lt;h2&gt;{translate} Dear Atteck {/translate} &lt;br/&gt;&lt;/h2&gt;{translate}Please complete registration&lt;/h5&gt; {/translate}


Output :

&lt;h2&gt; Дeaр Аттeҗк&lt;b/&gt;&lt;/h2&gt;Плeaсe җомплeтe&lt;/һ5&gt;


Main code:

private static readonly Dictionary&lt;string, IOrderedEnumerable&lt;KeyValuePair&lt;string, string&gt;&gt;&gt; TransliterationMaps = new Dictionary&lt;string, IOrderedEnumerable&lt;KeyValuePair&lt;string, string&gt;&gt;&gt;();

static void Main(string[] args)
{
    Transliterate();

    const string source = "&lt;h2&gt;{translate} Dear Atteck {/translate} &lt;br/&gt;&lt;/h2&gt;{translate}Please complete&lt;/h5&gt; {/translate} ";

    var splitData = Regex.Split(source, "{/");
    string alldata = string.Empty;

    foreach (var splt in splitData)
    {
        var data = splt.Split(new[] { "{translate}" }, StringSplitOptions.None);

        if (data.Count() &gt; 1)
        {
            data[0] = Regex.Replace(data[0], "[translate}]", string.Empty);
            var result = TransliterationMaps["tatartocyrillic"].Aggregate(data[1], (current, map) =&gt; current.Replace(map.Key, map.Value));
            alldata += data[0] + result;
        }
    }
    Console.WriteLine(alldata);
}


Transliterate() method

public static void Transliterate()
{
    var tatarToCyrillicMap = new Dictionary&lt;string, string&gt;();
    tatarToCyrillicMap.Add(('\u0079' + "" + '\u0075').ToString(CultureInfo.InvariantCulture), '\u044e'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add(('\u0059' + "" + '\u0075').ToString(CultureInfo.InvariantCulture), '\u042e'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add("YU", '\u042e'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add("yü", '\u044e'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add("Yü", '\u042e'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add("YÜ", '\u042e'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add(('\u0079' + "" + '\u0061').ToString(CultureInfo.InvariantCulture), '\u044f'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add("YA", '\u042f'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add(('\u0059' + "" + '\u0061').ToString(CultureInfo.InvariantCulture), '\u042f'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add("YO", '\u0451'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add(('\u0079' + "" + '\u006f').ToString(CultureInfo.InvariantCulture), '\u0451'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add(('\u0059' + "" + '\u006f').ToString(CultureInfo.InvariantCulture), '\u0401'.ToString(CultureInfo.InvariantCulture));
    tatarToCyrillicMap.Add(('\u0079' + "" + '\u00e4').ToString(CultureInfo.InvariantCulture), '\u044f'.ToString(CultureInfo.InvariantCulture));
    .......................
    ...................
    ...............
    .........

    TransliterationMaps.Add("tatartocyrillic", tatarToCyrillicMap.OrderByDescending(m =&gt; m.Key));
}


Can this code be optimized?
Consider moving what Transliterate() does to an external dictionary in a file that can be parsed by your program at runtime. You don't want to recompile your program every time you want to add something or change something in that map.