Golang获取当前区域性的十进制分隔符

Is there a way in Golang to get the current OS decimal separator in windows?

I know that in the Geographic area settings in control panel you can assign your custom decimal separator, so there must be a way to get this value... or no?

I want to use fmt.Printf() and format any float with the OS current decimal symbol.

I want to use fmt.Printf() and format any float with the OS current decimal symbol.

To get the current language OS, you might use a cross platform package such as https://github.com/cloudfoundry-attic/jibber_jabber

To print localized texts you might use the text package available here https://godoc.org/golang.org/x/text

Example

package main

import (
    "fmt"

    "github.com/cloudfoundry/jibber_jabber"
    "golang.org/x/text/language"
    "golang.org/x/text/message"
)

func main() {
    userLanguage, err := jibber_jabber.DetectLanguage()
    if err != nil {
        panic(err)
    }
    fmt.Println("Language:", userLanguage)

    tagLanguage := language.Make(userLanguage)
    fmt.Println("Language:", tagLanguage)

    {
        p := message.NewPrinter(language.BritishEnglish)
        p.Printf("There are %v flowers in our garden.
", 1500)
    }
    {
        p := message.NewPrinter(tagLanguage)
        p.Printf("There are %v flowers in our garden.
", 1500)
    }
}

As you can see you don t directly use the fmt package anymore, instead you have to create a Printer and use this one to display the texts appropriately.

to get more details about this package usage you can read https://phraseapp.com/blog/posts/internationalization-i18n-go/

Is there a way in Golang to get the current OS decimal separator in windows?

I have not been able to determine how to extract this information from the text package.