mirror of https://github.com/miguelmota/cointop
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.
29 lines
668 B
Go
29 lines
668 B
Go
//go:build !android
|
|
// +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
|
|
}
|