Documentation ¶
Overview ¶
Package translitbg is a Bulgarian-language transliteration package. It complies with the Bulgarian transliteration law which describes the "Streamlined System for the Romanization of Bulgarian" as the official transliteration method in the country.
The API can be used in a very simple way to encode cyrillic-characters text to its corresponding latin-characters version.
Example:
tr := translitbg.New() tr.Encode("абвгдежзийклмнопрстуфхцчшщъьюя") // Output: abvgdezhziyklmnoprstufhtschshshtayyuya
There are no state-related parameters stored in the translitbg object, so the same instance can be used to encode more text without the need to create new objects every time.
tr := translitbg.New() tr.Encode("Стара планина") // Output: Stara planina tr.Encode("Горна Оряховица") // Output: Gorna Oryahovitsa
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Възстановяването на оригиналната дума не е водещ принцип STREAMLINED = map[string]string{ "а": "a", "б": "b", "в": "v", "г": "g", "д": "d", "е": "e", "ж": "zh", "з": "z", "и": "i", "ѝ": "i", "й": "y", "к": "k", "л": "l", "м": "m", "н": "n", "о": "o", "п": "p", "р": "r", "с": "s", "т": "t", "у": "u", "ф": "f", "х": "h", "ц": "ts", "ч": "ch", "ш": "sh", "щ": "sht", "ъ": "a", "ь": "y", "ю": "yu", "я": "ya", "А": "A", "Б": "B", "В": "V", "Г": "G", "Д": "D", "Е": "E", "Ж": "Zh", "З": "Z", "И": "I", "Ѝ": "I", "Й": "Y", "К": "K", "Л": "L", "М": "M", "Н": "N", "О": "O", "П": "P", "Р": "R", "С": "S", "Т": "T", "У": "U", "Ф": "F", "Х": "H", "Ц": "Ts", "Ч": "Ch", "Ш": "Sh", "Щ": "Sht", "Ъ": "A", "Ь": "Y", "Ю": "Yu", "Я": "Ya", } STREAMLINED_TOKENS = map[string]string{ "ия": "ia", "Ия": "Ia", "иЯ": "iA", "ИЯ": "IA", } // uppercase cyrillic character to its uppercase latin combo equivalent STREAMLINED_CYR2COMBO_UC = map[rune]string{ 1046: "ZH", 1062: "TS", 1063: "CH", 1064: "SH", 1065: "SHT", 1070: "YU", 1071: "YA", } // БЪЛГАРИЯ BULGARIA_CYR_UP = []rune{1041, 1066, 1051, 1043, 1040, 1056, 1048, 1071} // българия BULGARIA_CYR_LOW = []rune{1073, 1098, 1083, 1075, 1072, 1088, 1080, 1103} // BULGARIA BULGARIA_LAT_UP = []rune{66, 85, 76, 71, 65, 82, 73, 65} // bulgaria BULGARIA_LAT_LOW = []rune{98, 117, 108, 103, 97, 114, 105, 97} )
Functions ¶
This section is empty.
Types ¶
type TranslitBG ¶
type TranslitBG struct {
// contains filtered or unexported fields
}
func New ¶
func New() *TranslitBG
Click to show internal directories.
Click to hide internal directories.