Okay, got the multilingualism working on windows.
Gettext calls on windows GetThreadLocale to retrieve locale. Therefore
setlocale wont work on windows. Also gettext reads out `LANG` and `LC_ALL`
environment variables (if one is set, GetThreadLocale wont be called). When
running in vscode integrated terminal it wont work, because vscode sets the
`LANG` environment variable -.-
* * *
Working example without gtk:
import os
when defined(windows):
import winim
{.passL:"""-LC:\msys64\mingw64\lib -l:libintl.a -l:libiconv.a""".}
proc setlocale(category: int, other: cstring): cstring {.header:
"<locale.h>", importc.}
var LC_ALL {.header: "<locale.h>", importc.}: int
else:
import posix
proc bindtextdomain(domainname: cstring, dirname: cstring): cstring
{.header: "<libintl.h>", importc, cdecl.}
proc dgettext (domainname: cstring, msgid: cstring): cstring {.header:
"<libintl.h>", importc, cdecl.}
discard bindtextdomain("gui", os.getCurrentDir() / "locale")
when defined(windows):
var lcid: LCID = LocaleNameToLCID("de-DE", LOCALE_ALLOW_NEUTRAL_NAMES)
discard SetThreadLocale(lcid)
else:
discard setlocale(LC_ALL, "de_DE")
echo dgettext("gui", "JOIN_CONNECT")
Run