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