(Windows) Added partial localization support

This commit is contained in:
Leon Styhre 2024-06-30 19:47:43 +02:00
parent c70684e654
commit 272e5834e0
5 changed files with 687 additions and 6 deletions

View file

@ -481,6 +481,7 @@ elseif(WIN32)
${CMAKE_CURRENT_SOURCE_DIR}/external/ffmpeg/include ${CMAKE_CURRENT_SOURCE_DIR}/external/ffmpeg/include
${CMAKE_CURRENT_SOURCE_DIR}/external/FreeImage/Dist/x64 ${CMAKE_CURRENT_SOURCE_DIR}/external/FreeImage/Dist/x64
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/include ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/include
${CMAKE_CURRENT_SOURCE_DIR}/external/gettext/include
${CMAKE_CURRENT_SOURCE_DIR}/external/libgit2/include ${CMAKE_CURRENT_SOURCE_DIR}/external/libgit2/include
${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml/src ${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml/src
${CMAKE_CURRENT_SOURCE_DIR}/external/SDL2) ${CMAKE_CURRENT_SOURCE_DIR}/external/SDL2)
@ -556,6 +557,7 @@ elseif(WIN32)
${PROJECT_SOURCE_DIR}/git2.lib ${PROJECT_SOURCE_DIR}/git2.lib
${PROJECT_SOURCE_DIR}/glew32.lib ${PROJECT_SOURCE_DIR}/glew32.lib
${PROJECT_SOURCE_DIR}/libcurl-x64.lib ${PROJECT_SOURCE_DIR}/libcurl-x64.lib
${PROJECT_SOURCE_DIR}/libintl-8.lib
${PROJECT_SOURCE_DIR}/freetype.lib ${PROJECT_SOURCE_DIR}/freetype.lib
${PROJECT_SOURCE_DIR}/lunasvg.lib ${PROJECT_SOURCE_DIR}/lunasvg.lib
${PROJECT_SOURCE_DIR}/pugixml.lib ${PROJECT_SOURCE_DIR}/pugixml.lib
@ -696,7 +698,7 @@ add_subdirectory(es-app)
add_dependencies(lunasvg es-pdf-convert) add_dependencies(lunasvg es-pdf-convert)
if (COMPILE_LOCALIZATIONS) if (COMPILE_LOCALIZATIONS)
add_dependencies(es-pdf-convert locale) add_dependencies(es-pdf-convert localization)
endif() endif()
add_dependencies(es-core rlottie) add_dependencies(es-core rlottie)

View file

@ -163,6 +163,7 @@ if(WIN32)
../glew32.dll ../glew32.dll
../libcrypto-3-x64.dll ../libcrypto-3-x64.dll
../libcurl-x64.dll ../libcurl-x64.dll
../libintl-8.dll
../libssl-3-x64.dll ../libssl-3-x64.dll
../lunasvg.dll ../lunasvg.dll
../pugixml.dll ../pugixml.dll

View file

@ -0,0 +1,642 @@
/* Message catalogs for internationalization.
Copyright (C) 1995-1997, 2000-2016, 2018-2024 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LIBINTL_H
#define _LIBINTL_H 1
#include <locale.h>
#if (defined __APPLE__ && defined __MACH__) && 0
# include <xlocale.h>
#endif
/* The LC_MESSAGES locale category is the category used by the functions
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
On systems that don't define it, use an arbitrary value instead.
On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
then includes <libintl.h> (i.e. this file!) and then only defines
LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
in this case. */
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
# define LC_MESSAGES 1729
#endif
/* We define an additional symbol to signal that we use the GNU
implementation of gettext. */
#define __USE_GNU_GETTEXT 1
/* Provide information about the supported file formats. Returns the
maximum minor revision number supported for a given major revision. */
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
((major) == 0 || (major) == 1 ? 1 : -1)
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
precedence over _conio_gettext. */
#ifdef __DJGPP__
# undef gettext
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Version number: (major<<16) + (minor<<8) + subminor */
#define LIBINTL_VERSION 0x001605
extern int libintl_version;
/* We redirect the functions to those prefixed with "libintl_". This is
necessary, because some systems define gettext/textdomain/... in the C
library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
If we used the unprefixed names, there would be cases where the
definition in the C library would override the one in the libintl.so
shared library. Recall that on ELF systems, the symbols are looked
up in the following order:
1. in the executable,
2. in the shared libraries specified on the link command line, in order,
3. in the dependencies of the shared libraries specified on the link
command line,
4. in the dlopen()ed shared libraries, in the order in which they were
dlopen()ed.
The definition in the C library would override the one in libintl.so if
either
* -lc is given on the link command line and -lintl isn't, or
* -lc is given on the link command line before -lintl, or
* libintl.so is a dependency of a dlopen()ed shared library but not
linked to the executable at link time.
Since Solaris gettext() behaves differently than GNU gettext(), this
would be unacceptable.
The redirection happens by default through macros in C, so that &gettext
is independent of the compilation unit, but through inline functions in
C++, in order not to interfere with the name mangling of class fields or
class methods called 'gettext'. */
/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
If he doesn't, we choose the method. A third possible method is
_INTL_REDIRECT_ASM, supported only by GCC. */
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
# if defined __GNUC__ && __GNUC__ >= 2 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
# define _INTL_REDIRECT_ASM
# else
# ifdef __cplusplus
# define _INTL_REDIRECT_INLINE
# else
# define _INTL_REDIRECT_MACROS
# endif
# endif
#endif
/* Auxiliary macros. */
#ifdef _INTL_REDIRECT_ASM
# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
# define _INTL_STRINGIFY(prefix) #prefix
#else
# define _INTL_ASM(cname)
#endif
/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
its n-th argument literally. This enables GCC to warn for example about
printf (gettext ("foo %y")). */
#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && !(defined __clang__ && __clang__ && __clang_major__ >= 3) && defined __cplusplus)
# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
#else
# define _INTL_MAY_RETURN_STRING_ARG(n)
#endif
/* _INTL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK))
declares that the STRING-INDEXth function argument is a format string of
style ARCHETYPE, which is one of:
printf, gnu_printf
scanf, gnu_scanf,
strftime, gnu_strftime,
strfmon,
or the same thing prefixed and suffixed with '__'.
If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
are suitable for the format string. */
/* Applies to: functions. */
#if (defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 7) > 2) || defined __clang__
# define _INTL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
#else
# define _INTL_ATTRIBUTE_FORMAT(spec)
#endif
/* _INTL_ATTRIBUTE_SPEC_PRINTF_STANDARD
An __attribute__ __format__ specifier for a function that takes a format
string and arguments, where the format string directives are the ones
standardized by ISO C99 and POSIX. */
/* __gnu_printf__ is supported in GCC >= 4.4. */
#if defined __GNUC__ && __GNUC__ + (__GNUC_MINOR__ >= 4) > 4
# define _INTL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__
#else
# define _INTL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__
#endif
/* _INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD
indicates to GCC that the function takes a format string and arguments,
where the format string directives are the ones standardized by ISO C99
and POSIX. */
#define _INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \
_INTL_ATTRIBUTE_FORMAT ((_INTL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument))
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_gettext (const char *__msgid)
_INTL_MAY_RETURN_STRING_ARG (1);
static inline
_INTL_MAY_RETURN_STRING_ARG (1)
char *gettext (const char *__msgid)
{
return libintl_gettext (__msgid);
}
#else
# ifdef _INTL_REDIRECT_MACROS
# define gettext libintl_gettext
# endif
extern char *gettext (const char *__msgid)
_INTL_ASM (libintl_gettext)
_INTL_MAY_RETURN_STRING_ARG (1);
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current
LC_MESSAGES locale. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
_INTL_MAY_RETURN_STRING_ARG (2);
static inline
_INTL_MAY_RETURN_STRING_ARG (2)
char *dgettext (const char *__domainname, const char *__msgid)
{
return libintl_dgettext (__domainname, __msgid);
}
#else
# ifdef _INTL_REDIRECT_MACROS
# define dgettext libintl_dgettext
# endif
extern char *dgettext (const char *__domainname, const char *__msgid)
_INTL_ASM (libintl_dgettext)
_INTL_MAY_RETURN_STRING_ARG (2);
#endif
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
int __category)
_INTL_MAY_RETURN_STRING_ARG (2);
static inline
_INTL_MAY_RETURN_STRING_ARG (2)
char *dcgettext (const char *__domainname, const char *__msgid, int __category)
{
return libintl_dcgettext (__domainname, __msgid, __category);
}
#else
# ifdef _INTL_REDIRECT_MACROS
# define dcgettext libintl_dcgettext
# endif
extern char *dcgettext (const char *__domainname, const char *__msgid,
int __category)
_INTL_ASM (libintl_dcgettext)
_INTL_MAY_RETURN_STRING_ARG (2);
#endif
/* Similar to 'gettext' but select the plural form corresponding to the
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n)
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
static inline
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2)
char *ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n)
{
return libintl_ngettext (__msgid1, __msgid2, __n);
}
#else
# ifdef _INTL_REDIRECT_MACROS
# define ngettext libintl_ngettext
# endif
extern char *ngettext (const char *__msgid1, const char *__msgid2,
unsigned long int __n)
_INTL_ASM (libintl_ngettext)
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
#endif
/* Similar to 'dgettext' but select the plural form corresponding to the
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
const char *__msgid2, unsigned long int __n)
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
static inline
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3)
char *dngettext (const char *__domainname, const char *__msgid1,
const char *__msgid2, unsigned long int __n)
{
return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
}
#else
# ifdef _INTL_REDIRECT_MACROS
# define dngettext libintl_dngettext
# endif
extern char *dngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n)
_INTL_ASM (libintl_dngettext)
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
#endif
/* Similar to 'dcgettext' but select the plural form corresponding to the
number N. */
#ifdef _INTL_REDIRECT_INLINE
extern char *libintl_dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n, int __category)
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
static inline
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3)
char *dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n, int __category)
{
return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
}
#else
# ifdef _INTL_REDIRECT_MACROS
# define dcngettext libintl_dcngettext
# endif
extern char *dcngettext (const char *__domainname,
const char *__msgid1, const char *__msgid2,
unsigned long int __n, int __category)
_INTL_ASM (libintl_dcngettext)
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
#endif
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
# ifdef _INTL_REDIRECT_INLINE
extern char *libintl_textdomain (const char *__domainname);
static inline char *textdomain (const char *__domainname)
{
return libintl_textdomain (__domainname);
}
# else
# ifdef _INTL_REDIRECT_MACROS
# define textdomain libintl_textdomain
# endif
extern char *textdomain (const char *__domainname)
_INTL_ASM (libintl_textdomain);
# endif
/* Specify that the DOMAINNAME message catalog will be found
in DIRNAME rather than in the system locale data base. */
# ifdef _INTL_REDIRECT_INLINE
extern char *libintl_bindtextdomain (const char *__domainname,
const char *__dirname);
static inline char *bindtextdomain (const char *__domainname,
const char *__dirname)
{
return libintl_bindtextdomain (__domainname, __dirname);
}
# else
# ifdef _INTL_REDIRECT_MACROS
# define bindtextdomain libintl_bindtextdomain
# endif
extern char *bindtextdomain (const char *__domainname, const char *__dirname)
_INTL_ASM (libintl_bindtextdomain);
# endif
# if defined _WIN32 && !defined __CYGWIN__
/* Specify that the DOMAINNAME message catalog will be found
in WDIRNAME rather than in the system locale data base. */
# ifdef _INTL_REDIRECT_INLINE
extern wchar_t *libintl_wbindtextdomain (const char *__domainname,
const wchar_t *__wdirname);
static inline wchar_t *wbindtextdomain (const char *__domainname,
const wchar_t *__wdirname)
{
return libintl_wbindtextdomain (__domainname, __wdirname);
}
# else
# ifdef _INTL_REDIRECT_MACROS
# define wbindtextdomain libintl_wbindtextdomain
# endif
extern wchar_t *wbindtextdomain (const char *__domainname,
const wchar_t *__wdirname)
_INTL_ASM (libintl_wbindtextdomain);
# endif
# endif
/* Specify the character encoding in which the messages from the
DOMAINNAME message catalog will be returned. */
# ifdef _INTL_REDIRECT_INLINE
extern char *libintl_bind_textdomain_codeset (const char *__domainname,
const char *__codeset);
static inline char *bind_textdomain_codeset (const char *__domainname,
const char *__codeset)
{
return libintl_bind_textdomain_codeset (__domainname, __codeset);
}
# else
# ifdef _INTL_REDIRECT_MACROS
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
# endif
extern char *bind_textdomain_codeset (const char *__domainname,
const char *__codeset)
_INTL_ASM (libintl_bind_textdomain_codeset);
# endif
/* Support for format strings with positions in *printf(), following the
POSIX/XSI specification.
Note: These replacements for the *printf() functions are visible only
in source files that #include <libintl.h> or #include "gettext.h".
Packages that use *printf() in source files that don't refer to _()
or gettext() but for which the format string could be the return value
of _() or gettext() need to add this #include. Oh well. */
/* Note: In C++ mode, it is not sufficient to redefine a symbol at the
preprocessor macro level, such as
#define sprintf libintl_sprintf
Some programs may reference std::sprintf after including <libintl.h>.
Therefore we must make sure that std::libintl_sprintf is defined and
identical to ::libintl_sprintf.
The user can define _INTL_CXX_NO_CLOBBER_STD_NAMESPACE to avoid this.
In such cases, they will not benefit from the overrides when using
the 'std' namespace, and they will need to do the references to the
'std' namespace *before* including <libintl.h> or "gettext.h". */
#if !0
# include <stdio.h>
# include <stddef.h>
/* Get va_list. */
# if (defined __STDC__ && __STDC__) || defined __cplusplus || defined _MSC_VER
# include <stdarg.h>
# else
# include <varargs.h>
# endif
# if !((defined fprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_fprintf) /* don't override gnulib */
# undef fprintf
# define fprintf libintl_fprintf
extern int fprintf (FILE *, const char *, ...)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_fprintf; }
# endif
# endif
# if !((defined vfprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_vfprintf) /* don't override gnulib */
# undef vfprintf
# define vfprintf libintl_vfprintf
extern int vfprintf (FILE *, const char *, va_list)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vfprintf; }
# endif
# endif
# if !((defined printf && defined _GL_STDIO_H) || defined GNULIB_overrides_printf) /* don't override gnulib */
# undef printf
# if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
/* Don't break __attribute__((format(printf,M,N))).
This redefinition is only possible because the libc in NetBSD, Cygwin,
mingw does not have a function __printf__.
Alternatively, we could have done this redirection only when compiling with
__GNUC__, together with a symbol redirection:
extern int printf (const char *, ...)
__asm__ (#__USER_LABEL_PREFIX__ "libintl_printf");
But doing it now would introduce a binary incompatibility with already
distributed versions of libintl on these systems. */
# define libintl_printf __printf__
# endif
# define printf libintl_printf
extern int printf (const char *, ...)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_printf; }
# endif
# endif
# if !((defined vprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_vprintf) /* don't override gnulib */
# undef vprintf
# define vprintf libintl_vprintf
extern int vprintf (const char *, va_list)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vprintf; }
# endif
# endif
# if !((defined sprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_sprintf) /* don't override gnulib */
# undef sprintf
# define sprintf libintl_sprintf
extern int sprintf (char *, const char *, ...)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_sprintf; }
# endif
# endif
# if !((defined vsprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_vsprintf) /* don't override gnulib */
# undef vsprintf
# define vsprintf libintl_vsprintf
extern int vsprintf (char *, const char *, va_list)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vsprintf; }
# endif
# endif
# if 1
# if !((defined snprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_snprintf) /* don't override gnulib */
# undef snprintf
# define snprintf libintl_snprintf
extern int snprintf (char *, size_t, const char *, ...)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_snprintf; }
# endif
# endif
# if !((defined vsnprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_vsnprintf) /* don't override gnulib */
# undef vsnprintf
# define vsnprintf libintl_vsnprintf
extern int vsnprintf (char *, size_t, const char *, va_list)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vsnprintf; }
# endif
# endif
# endif
# if 1
# if !((defined asprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_asprintf) /* don't override gnulib */
# undef asprintf
# define asprintf libintl_asprintf
extern int asprintf (char **, const char *, ...)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_asprintf; }
# endif
# endif
# if !((defined vasprintf && defined _GL_STDIO_H) || defined GNULIB_overrides_vasprintf) /* don't override gnulib */
# undef vasprintf
# define vasprintf libintl_vasprintf
extern int vasprintf (char **, const char *, va_list)
_INTL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vasprintf; }
# endif
# endif
# endif
# if 1
# undef fwprintf
# define fwprintf libintl_fwprintf
extern int fwprintf (FILE *, const wchar_t *, ...);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_fwprintf; }
# endif
# undef vfwprintf
# define vfwprintf libintl_vfwprintf
extern int vfwprintf (FILE *, const wchar_t *, va_list);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vfwprintf; }
# endif
# undef wprintf
# define wprintf libintl_wprintf
extern int wprintf (const wchar_t *, ...);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_wprintf; }
# endif
# undef vwprintf
# define vwprintf libintl_vwprintf
extern int vwprintf (const wchar_t *, va_list);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vwprintf; }
# endif
# undef swprintf
# define swprintf libintl_swprintf
extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_swprintf; }
# endif
# undef vswprintf
# define vswprintf libintl_vswprintf
extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_vswprintf; }
# endif
# endif
#endif
/* Support for retrieving the name of a locale_t object. */
#if 0
# ifndef GNULIB_defined_newlocale /* don't override gnulib */
# undef newlocale
# define newlocale libintl_newlocale
extern locale_t newlocale (int, const char *, locale_t);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_newlocale; }
# endif
# endif
# ifndef GNULIB_defined_duplocale /* don't override gnulib */
# undef duplocale
# define duplocale libintl_duplocale
extern locale_t duplocale (locale_t);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_duplocale; }
# endif
# endif
# ifndef GNULIB_defined_freelocale /* don't override gnulib */
# undef freelocale
# define freelocale libintl_freelocale
extern void freelocale (locale_t);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_freelocale; }
# endif
# endif
#endif
/* Support for the locale chosen by the user. */
#if (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__
# ifndef GNULIB_defined_setlocale /* don't override gnulib */
# undef setlocale
# define setlocale libintl_setlocale
extern char *setlocale (int, const char *);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_setlocale; }
# endif
# endif
# if 0
# undef newlocale
# define newlocale libintl_newlocale
/* Declare newlocale() only if the system headers define the 'locale_t' type. */
# if !(defined __CYGWIN__ && !defined LC_ALL_MASK)
extern locale_t newlocale (int, const char *, locale_t);
# if defined __cplusplus && !defined _INTL_CXX_NO_CLOBBER_STD_NAMESPACE
namespace std { using ::libintl_newlocale; }
# endif
# endif
# endif
#endif
/* Support for relocatable packages. */
/* Sets the original and the current installation prefix of the package.
Relocation simply replaces a pathname starting with the original prefix
by the corresponding pathname with the current prefix instead. Both
prefixes should be directory names without trailing slash (i.e. use ""
instead of "/"). */
#define libintl_set_relocation_prefix libintl_set_relocation_prefix
extern void
libintl_set_relocation_prefix (const char *orig_prefix,
const char *curr_prefix);
#ifdef __cplusplus
}
#endif
#endif /* libintl.h */

View file

@ -6,10 +6,12 @@
# CMake configuration for compiling localization message catalog files using msgfmt # CMake configuration for compiling localization message catalog files using msgfmt
# #
add_custom_target(locale ALL COMMENT "Compiling localization message catalogs") add_custom_target(localization ALL COMMENT Compiling localization message catalogs)
if(APPLE) if(APPLE)
set(MSGFMT_BINARY ${PROJECT_SOURCE_DIR}/external/local_install/bin/msgfmt) set(MSGFMT_BINARY ${PROJECT_SOURCE_DIR}/external/local_install/bin/msgfmt)
elseif(WIN32)
set(MSGFMT_BINARY ${PROJECT_SOURCE_DIR}/external/gettext/bin/msgfmt.exe)
else() else()
find_program(MSGFMT_BINARY msgfmt) find_program(MSGFMT_BINARY msgfmt)
endif() endif()
@ -23,9 +25,9 @@ file(GLOB PO_FILES ${PROJECT_SOURCE_DIR}/locale/po/*.po)
foreach (PO_FILE ${PO_FILES}) foreach (PO_FILE ${PO_FILES})
get_filename_component(PO_FILENAME ${PO_FILE} NAME) get_filename_component(PO_FILENAME ${PO_FILE} NAME)
get_filename_component(PO_BASENAME ${PO_FILENAME} NAME_WE) get_filename_component(PO_BASENAME ${PO_FILENAME} NAME_WE)
add_custom_command(TARGET locale COMMAND echo "Compiling message catalog for locale" ${PO_BASENAME}) add_custom_command(TARGET localization COMMAND echo Compiling message catalog for locale ${PO_BASENAME})
add_custom_command(TARGET locale COMMAND mkdir -p ${PROJECT_SOURCE_DIR}/resources/locale/${PO_BASENAME}/LC_MESSAGES) file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/resources/locale/${PO_BASENAME}/LC_MESSAGES)
add_custom_command(TARGET locale COMMAND ${MSGFMT_BINARY} -c --statistics -o ${PROJECT_SOURCE_DIR}/resources/locale/${PO_BASENAME}/LC_MESSAGES/${PO_BASENAME}.mo ${PO_FILE}) add_custom_command(TARGET localization COMMAND ${MSGFMT_BINARY} -c --statistics -o ${PROJECT_SOURCE_DIR}/resources/locale/${PO_BASENAME}/LC_MESSAGES/${PO_BASENAME}.mo ${PO_FILE})
endforeach() endforeach()
add_custom_command(TARGET locale COMMAND echo) add_custom_command(TARGET localization COMMAND echo)

View file

@ -33,6 +33,40 @@ echo:
cd external cd external
echo Setting up gettext
if exist gettext\ (
rmdir /S /Q gettext
)
mkdir gettext
cd gettext
curl -LO https://github.com/vslavik/gettext-tools-windows/releases/download/v0.22.5/gettext-tools-windows-0.22.5.zip
7z x gettext-tools-windows-0.22.5.zip
if not exist bin\msgfmt.exe (
echo msgfmt.exe is missing, aborting.
cd ..\..
goto end
)
mkdir include
copy ..\..\es-app\assets\libintl_Windows.h include\libintl.h
cd bin
dumpbin /exports libintl-8.dll > exports.txt
echo LIBRARY libintl-8 > libintl-8.def
echo EXPORTS >> libintl-8.def
for /f "skip=90 tokens=4" %%A in (exports.txt) do echo %%A >> libintl-8.def
echo DllMain >> libintl-8.def
lib /def:libintl-8.def /out:libintl-8.lib /machine:x64
copy /Y libintl-8.dll ..\..\..
copy /Y libintl-8.lib ..\..\..
cd ..\..
echo Setting up curl echo Setting up curl
if exist curl-8.2.1_11-win64-mingw\ ( if exist curl-8.2.1_11-win64-mingw\ (