You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cointop/vendor/github.com/jeandeaual/go-locale/util.go

28 lines
648 B
Go

// +build !android
package locale
import (
"strings"
)
// SetRunOnJVM is a noop, this function is only valid on Android
func SetRunOnJVM(fn func(fn func(vm, env, ctx uintptr) error) error) {}
func splitLocale(locale string) (string, string) {
// Remove the encoding, if present
formattedLocale := strings.Split(locale, ".")[0]
// Normalize by replacing the hyphens with underscores
formattedLocale = strings.Replace(formattedLocale, "-", "_", -1)
// Split at the underscore
split := strings.Split(formattedLocale, "_")
language := split[0]
territory := ""
if len(split) > 1 {
territory = split[1]
}
return language, territory
}