I would like to convert locale tag to IETF standard.
IETF language tag asserts en-US
as a correct tag for American English.
In may case, it's possible that I would get en_US
as an input.
Currently I'm using this method:
func toLanguageTag(l string) string {
return strings.Replace(l, "_", "-", -1)
}
For example, I know that Java has toLanguageTag
method. Should I continue use this approach, or there is more preferable way to do what I want?