Compare commits
2 Commits
df743cca96
...
4bc6eb9d41
Author | SHA1 | Date | |
---|---|---|---|
4bc6eb9d41 | |||
2a59e74a2c |
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,14 @@ func (ct *ChineseTranslit) Transliterate(s string) string {
|
||||
outBuf.WriteRune(char)
|
||||
}
|
||||
}
|
||||
if tmpBuf.Len() > 0 {
|
||||
// Convert to pinyin (without tones)
|
||||
out := pinyin.LazyConvert(tmpBuf.String(), nil)
|
||||
// Write space-separated string to output
|
||||
outBuf.WriteString(strings.Join(out, " "))
|
||||
// Reset temporary buffer
|
||||
tmpBuf.Reset()
|
||||
}
|
||||
// Return output string
|
||||
return outBuf.String()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user