Add and fix comments, fix transliteration maps so only first character is capitalized

This commit is contained in:
2021-10-06 13:26:16 -07:00
parent 4bc6eb9d41
commit c23201e18c
3 changed files with 15 additions and 7 deletions

View File

@@ -124,16 +124,23 @@ var armenianMap = []string{
func (at *ArmenianTranslit) Init() {
if !at.initComplete {
// Copy map as original will be changed
lower := armenianMap
// For every value in copied map
for i, val := range lower {
// If index is odd, skip
if i%2 == 1 {
continue
}
// Capitalize first letter
capital := strings.Title(val)
// If capital is not the same as lowercase
if capital != val {
// Add capital to map
armenianMap = append(armenianMap, capital, strings.Title(armenianMap[i+1]))
}
}
// Set init complete to true so it is not run again
at.initComplete = true
}
}