Command line client for Write.as https://write.as/apps/cli
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
490 B

  1. package jibber_jabber
  2. import (
  3. "strings"
  4. )
  5. const (
  6. COULD_NOT_DETECT_PACKAGE_ERROR_MESSAGE = "Could not detect Language"
  7. )
  8. func splitLocale(locale string) (string, string) {
  9. formattedLocale := strings.Split(locale, ".")[0]
  10. formattedLocale = strings.Replace(formattedLocale, "-", "_", -1)
  11. pieces := strings.Split(formattedLocale, "_")
  12. language := pieces[0]
  13. territory := ""
  14. if len(pieces) > 1 {
  15. territory = strings.Split(formattedLocale, "_")[1]
  16. }
  17. return language, territory
  18. }