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
#include <windows.h>
#include <dwmapi.h>
#include <glib/gwin32.h>
#else
#include <unistd.h>
#endif
@@ -301,9 +302,28 @@ fe_args (int argc, char *argv[])
GOptionContext *context;
char *buffer;
const char *desktop_id = "net.zoite.Zoitechat";
#ifdef WIN32
char *base_path = NULL;
char *locale_path = NULL;
#endif
#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);
#endif
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif

View File

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