Skip to content

Commit

Permalink
Fix/improve i18n related thing
Browse files Browse the repository at this point in the history
This contains a fix of the build fail with enabling
NLS support on BSD-based system.

Fixes dov#59
  • Loading branch information
tagoh committed Mar 30, 2023
1 parent 92cadd6 commit a4bdc81
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Package name for gettext.])

ALL_LINGUAS=""
AM_GLIB_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION([0.19.7])
AM_GNU_GETTEXT([external])

datadir='${prefix}/${DATADIRNAME}'
AC_SUBST(datadir)
Expand Down
5 changes: 3 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ endif
# This is available pretty much everywhere
cdata.set('HAVE_STRINGIZE', 1)

# Assume we have nls, since paps doesn't compile without it
cdata.set('ENABLE_NLS',1)
# i18n support
i18n = import('i18n')

# Not really sure what this is used for, but paps doesn't compile without it.
cdata.set_quoted('DATADIR','.')
Expand All @@ -69,3 +69,4 @@ install_data(['scripts/src-to-paps'],
install_dir : 'bin')

subdir('src')
subdir('po')
Empty file added po/LINGUAS
Empty file.
1 change: 1 addition & 0 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
i18n.gettext(meson.project_name())
4 changes: 3 additions & 1 deletion src/paps.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ using namespace fmt;
#endif
#include <wchar.h>

#if ENABLE_NLS
#ifdef ENABLE_NLS
#include <libintl.h>

#define _(str) gettext(str)
Expand Down Expand Up @@ -700,9 +700,11 @@ int main(int argc, char *argv[])
(void) setlocale(LC_ALL, "");

/* Setup i18n */
#ifdef ENABLE_NLS
textdomain(GETTEXT_PACKAGE);
bindtextdomain(GETTEXT_PACKAGE, DATADIR "/locale");
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif

/* Setup the paps glyph face */
paps_glyph_face = cairo_user_font_face_create();
Expand Down

0 comments on commit a4bdc81

Please sign in to comment.