rthornton128 / goncurses

NCurses Library for Go
Other
383 stars 51 forks source link

multi language support #75

Closed tfcolin closed 2 months ago

tfcolin commented 1 year ago

Thanks the authors to export this useful UI library to golang. Just one suggestion:

Could you please add a "locale" parameter to Init () function to support multi language? As:

// #include // #include ...

func Init (locale string) { locale_cstr := C.CString(locale) C.setlocale (C.LC_ALL, locale_cstr) defer C.free(unsafe.Pointer(locale_cstr)) stdscr = &Window{C.initscr()} .... }

rthornton128 commented 2 months ago

As much as I understand your need, the locale library is outside the scope of ncurses, which is what goncurses is providing bindings for. I'm hesitant to conflate the two libraries. The wiki provides some limited guidance on how to set the locale and some searching did reveal a few other Go libraries that are available.

Duplicate of: https://github.com/rthornton128/goncurses/issues/47 and https://github.com/rthornton128/goncurses/issues/64

tfcolin commented 2 months ago

Thanks for your response. I forked your repository and solved it.

BTW, it seems that the package (https://github.com/Xuanwo/go-locale) mentioned in your wiki page can only detect the locale for current platform, not call setlocale.