Re: [Tuxpaint-devel] *SDL2* translation does not work on the latest MinGW/MSYS2
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
|
From: Shin-ichi T. <sh...@wm...> - 2022-02-02 13:43:51
|
Hi!
On Sun, 30 Jan 2022 20:28:10 +0100, Pere Pujal i Carabantes wrote:
>After some more tests with bindtextdomain, I couldn't make it working
>with any of the combinations of the locale string I tested,
>maybe you could have more luck.
>
>What works for me is to use the full path,
>copying/adapting some code from chdir_to_binary from tuxpaint.c
>and get_fname from fname.c:
>
>
> char curdir[256];
> char f[512];
>
> getcwd(curdir, sizeof(curdir));
> #ifdef DEBUG
> printf("Current directory at launchtime: %s\n", curdir);
> #endif
>
> snprintf(f, sizeof(f),
> "%s%s",
> curdir, "\\\\locale\\\\");
>
>
> bindtextdomain("tuxpaint", f);
Committed it to the master branch as follows.
+#ifdef WIN32
+ // FIXME: After the update of MinGW/MSYS2 in January 2022, gettext() no longer find
+ // translation (.mo) files unless dirname is specified by full path.
+ //
+ // -- 2022/02/02: Shin-ichi TOYAMA & Pere Pujal i Carabantes
+ char curdir[256];
+ char f[512];
+ getcwd(curdir, sizeof(curdir));
+ snprintf(f, sizeof(f), "%s%s", curdir, "\\locale");
+#ifdef DEBUG
+ printf("Current directory at launchtime: %s\n", curdir);
+ printf("Localedir is set to: %s\n", f);
+#endif
+ bindtextdomain("tuxpaint", f);
+#else
bindtextdomain("tuxpaint", LOCALEDIR);
+#endif
Thanks!!
|