-
Notifications
You must be signed in to change notification settings - Fork 1
/
play_store_locales.go
129 lines (120 loc) · 2.15 KB
/
play_store_locales.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package main
import (
"math"
"strings"
"github.com/agnivade/levenshtein"
)
type locales map[string]interface{}
func (l locales) contains(locale string) bool {
_, ok := l[locale]
return ok
}
// closestMatch returns the closest match for the `locale` this `locales`.
func (l locales) closestMatch(locale string) string {
d := math.MaxInt
s := ""
for key := range l {
// the following has the highest priority since play store refuses many
// locales with missing region suffix.
splits := strings.Split(key, "-")
if len(splits) > 1 && splits[0] == locale {
return key
}
nd := levenshtein.ComputeDistance(locale, key)
if nd < d {
d = nd
s = key
}
}
return s
}
// playStoreLocales declares locales recognised by the Play Store Listing.
var playStoreLocales = locales{
"af": nil,
"sq": nil,
"am": nil,
"ar": nil,
"hy-AM": nil,
"az-AZ": nil,
"bn-BD": nil,
"eu-ES": nil,
"be": nil,
"bg": nil,
"my-MM": nil,
"ca": nil,
"zh-HK": nil,
"zh-CN": nil,
"zh-TW": nil,
"hr": nil,
"cs-CZ": nil,
"da-DK": nil,
"nl-NL": nil,
"en-AU": nil,
"en-CA": nil,
"en-GB": nil,
"en-IN": nil,
"en-SG": nil,
"en-US": nil,
"en-ZA": nil,
"et": nil,
"fil": nil,
"fi-FI": nil,
"fr-CA": nil,
"fr-FR": nil,
"gl-ES": nil,
"ka-GE": nil,
"de-DE": nil,
"el-GR": nil,
"gu": nil,
"iw-IL": nil,
"hi-IN": nil,
"hu-HU": nil,
"is-IS": nil,
"id": nil,
"it-IT": nil,
"ja-JP": nil,
"kn-IN": nil,
"kk": nil,
"km-KH": nil,
"ko-KR": nil,
"ky-KG": nil,
"lo-LA": nil,
"lv": nil,
"lt": nil,
"mk-MK": nil,
"ms-MY": nil,
"ms": nil,
"ml-IN": nil,
"mr-IN": nil,
"mn-MN": nil,
"ne-NP": nil,
"no-NO": nil,
"fa": nil,
"fa-AE": nil,
"fa-AF": nil,
"fa-IR": nil,
"pl-PL": nil,
"pt-BR": nil,
"pt-PT": nil,
"pa": nil,
"ro": nil,
"rm": nil,
"ru-RU": nil,
"sr": nil,
"si-LK": nil,
"sk": nil,
"sl": nil,
"es-419": nil,
"es-ES": nil,
"es-US": nil,
"sw": nil,
"sv-SE": nil,
"ta-IN": nil,
"te-IN": nil,
"th": nil,
"tr-TR": nil,
"uk": nil,
"ur": nil,
"vi": nil,
"zu": nil,
}