mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-24 14:30:18 +00:00
Merge pull request #150 from ZoiteChat/localization-fixes
Fix Windows locale path resolution in both frontends
This commit is contained in:
@@ -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);
|
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");
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||||
textdomain (GETTEXT_PACKAGE);
|
textdomain (GETTEXT_PACKAGE);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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);
|
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");
|
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||||
textdomain (GETTEXT_PACKAGE);
|
textdomain (GETTEXT_PACKAGE);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user