Fix Windows locale path resolution in both frontends

This commit is contained in:
2026-03-23 22:33:34 -06:00
parent a57104469d
commit 6527c08e4d
2 changed files with 40 additions and 0 deletions

View File

@@ -29,6 +29,7 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#include <dwmapi.h> #include <dwmapi.h>
#include <glib/gwin32.h>
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
@@ -301,9 +302,28 @@ fe_args (int argc, char *argv[])
GOptionContext *context; GOptionContext *context;
char *buffer; char *buffer;
const char *desktop_id = "net.zoite.Zoitechat"; const char *desktop_id = "net.zoite.Zoitechat";
#ifdef WIN32
char *base_path = NULL;
char *locale_path = NULL;
#endif
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
#ifdef WIN32
base_path = g_win32_get_package_installation_directory_of_module (NULL);
if (base_path)
{
locale_path = g_build_filename (base_path, "share", "locale", NULL);
bindtextdomain (GETTEXT_PACKAGE, locale_path);
}
else
{
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
}
g_free (locale_path);
g_free (base_path);
#else
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
#endif
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
#endif #endif

View File

@@ -26,6 +26,7 @@
#endif #endif
#ifdef WIN32 #ifdef WIN32
#include <io.h> #include <io.h>
#include <glib/gwin32.h>
#define STDIN_FILENO 0 #define STDIN_FILENO 0
#define STDOUT_FILENO 1 #define STDOUT_FILENO 1
#else #else
@@ -478,9 +479,28 @@ fe_args (int argc, char *argv[])
{ {
GError *error = NULL; GError *error = NULL;
GOptionContext *context; GOptionContext *context;
#ifdef WIN32
char *base_path = NULL;
char *locale_path = NULL;
#endif
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
#ifdef WIN32
base_path = g_win32_get_package_installation_directory_of_module (NULL);
if (base_path)
{
locale_path = g_build_filename (base_path, "share", "locale", NULL);
bindtextdomain (GETTEXT_PACKAGE, locale_path);
}
else
{
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
}
g_free (locale_path);
g_free (base_path);
#else
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
#endif
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
#endif #endif