Only do init once for Armenian transliteration
This commit is contained in:
parent
fe4b0ec203
commit
a4598269e5
@ -4,7 +4,9 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ArmenianTranslit struct{}
|
||||
type ArmenianTranslit struct {
|
||||
initComplete bool
|
||||
}
|
||||
|
||||
var armenianMap = []string{
|
||||
"աու", "au",
|
||||
@ -121,15 +123,18 @@ var armenianMap = []string{
|
||||
}
|
||||
|
||||
func (at *ArmenianTranslit) Init() {
|
||||
lower := armenianMap
|
||||
for i, val := range lower {
|
||||
if i%2 == 1 {
|
||||
continue
|
||||
}
|
||||
capital := strings.Title(val)
|
||||
if capital != val {
|
||||
armenianMap = append(armenianMap, capital, strings.Title(armenianMap[i+1]))
|
||||
if !at.initComplete {
|
||||
lower := armenianMap
|
||||
for i, val := range lower {
|
||||
if i%2 == 1 {
|
||||
continue
|
||||
}
|
||||
capital := strings.Title(val)
|
||||
if capital != val {
|
||||
armenianMap = append(armenianMap, capital, strings.Title(armenianMap[i+1]))
|
||||
}
|
||||
}
|
||||
at.initComplete = true
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user