MCPcopy
hub / github.com/cloudfoundry/cli / SupportedLocales

Function SupportedLocales

cf/i18n/locale.go:13–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11const resourceSuffix = ".all.json"
12
13func SupportedLocales() []string {
14 languages := supportedLanguages()
15 localeNames := make([]string, len(languages))
16
17 for i, l := range languages {
18 localeParts := strings.Split(l, "-")
19 lang := localeParts[0]
20 regionOrScript := localeParts[1]
21
22 switch len(regionOrScript) {
23 case 2: // Region
24 localeNames[i] = lang + "-" + strings.ToUpper(regionOrScript)
25 case 4: // Script
26 localeNames[i] = lang + "-" + strings.Title(regionOrScript)
27 default:
28 localeNames[i] = l
29 }
30 }
31
32 return localeNames
33}
34
35func IsSupportedLocale(locale string) bool {
36 sanitizedLocale, err := ui.ParseLocale(locale)

Callers 3

listLocalesMethod · 0.92
locale_test.goFile · 0.92
ExecuteMethod · 0.85

Calls 2

supportedLanguagesFunction · 0.85
TitleMethod · 0.80

Tested by

no test coverage detected