Class Transliterator
The object which alows to make transliteration of text from any national language to the english. You can assign the Default property as a convertion table to be possible to use specific language you want. If it is not changed explicit then the Russian table will be used.
Inheritance
Inherited Members
Namespace: SprutTechnology.SCPostprocessor
Assembly: SCPostprocessor.dll
Syntax
public static class Transliterator
Properties
Default
The default table of char pairs to be used for transliteration. Russian table is assigned as a default right after the Transliterator class is created. But you always can assign your own as shown below.
Declaration
public static TransliterationTable Default { get; set; }
Property Value
Type | Description |
---|---|
TransliterationTable |
Remarks
Transliterator.Default = new TransliterationTable(
new TranslitPair[] {
new TranslitPair("а", "a"),
new TranslitPair("б", "b"),
new TranslitPair("в", "v"),
new TranslitPair("г", "g"),
new TranslitPair("д", "d"),
new TranslitPair("е", "e"),
new TranslitPair("ё", "yo"),
new TranslitPair("ж", "zh"),
new TranslitPair("з", "z"),
new TranslitPair("и", "i"),
new TranslitPair("й", "i"),
new TranslitPair("к", "k"),
new TranslitPair("л", "l"),
new TranslitPair("м", "m"),
new TranslitPair("н", "n"),
new TranslitPair("о", "o"),
new TranslitPair("п", "p"),
new TranslitPair("р", "r"),
new TranslitPair("с", "s"),
new TranslitPair("т", "t"),
new TranslitPair("у", "u"),
new TranslitPair("ф", "f"),
new TranslitPair("х", "h"),
new TranslitPair("ц", "c"),
new TranslitPair("ч", "ch"),
new TranslitPair("ш", "sh"),
new TranslitPair("щ", "shh"),
new TranslitPair("ъ", ""),
new TranslitPair("ы", "y"),
new TranslitPair("ь", ""),
new TranslitPair("э", "e"),
new TranslitPair("ю", "yu"),
new TranslitPair("я", "ya")
}
);
Russian
The transliteration table from the russian language to english. It is assigned as a default right after the Transliterator class is created.
Declaration
public static TransliterationTable Russian { get; }
Property Value
Type | Description |
---|---|
TransliterationTable |
Methods
Convert(String)
Converts the specified string from the national language to english using the Default transliteration table.
Declaration
public static string Convert(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The source (national) text to be transliterated. |
Returns
Type | Description |
---|---|
System.String | Returns the result of transliteration - the source string where all characters was replaced to english. |
Convert(String, TransliterationTable)
Converts the specified string from the national language to english using specified transliteration table.
Declaration
public static string Convert(string source, TransliterationTable table)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The source (national) text to be transliterated. |
TransliterationTable | table | The default table of char pairs to be used for transliteration. |
Returns
Type | Description |
---|---|
System.String | Returns the result of transliteration - the source string where all characters was replaced to english. |