1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-03 12:24:17 +01:00

configure: rewrote the support for option '--with-menu-textdomain'

The idea is to include consistency check to warn the user if he is not
using it properly, instead of silently misbehaving;

Updated code style to use Autoconf macros for consistency.

Took opportunity to remove the hacky setting inside 'config-paths.h' where
it is a bit out of place, in favour of a standard DEFINE in the 'config.h'.

Include in the i18n documentation the explanation on how Window Maker
translates the menus, both when the 'menu-textdomain' option is used and
when it is not.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-01-20 22:04:02 +01:00
committed by Carlos R. Mafra
parent bf6bc120a5
commit f222a319b1
4 changed files with 60 additions and 17 deletions

View File

@@ -12,13 +12,6 @@ config-paths.h: Makefile
@echo "Generating $@"
@echo '/* this is a generated file - do not edit */' > $@
@echo '' >> $@
@echo '/* gettext domain used for menu translations */' >> $@
@if test -z "$(menutextdomain)"; then \
echo '/* #undef MENU_TEXTDOMAIN "$(menutextdomain)" */' >> $@; \
else \
echo '#define MENU_TEXTDOMAIN "$(menutextdomain)"' >> $@; \
fi
@echo '' >> $@
@echo '/* define where the translations are stored */' >> $@
@echo '#define LOCALEDIR "$(localedir)"' >> $@
@echo '' >> $@

View File

@@ -418,6 +418,7 @@ dnl Detect the language for translations to be installed and check
dnl that the gettext environment works
WM_I18N_LANGUAGES
WM_I18N_XGETTEXT
WM_I18N_MENUTEXTDOMAIN
dnl 2014/12/29: The option is deprecated, we should keep this message for at
dnl least 2 years to ensure users see it and update their build scripts
@@ -425,16 +426,6 @@ AC_ARG_WITH([nlsdir], [],
[AC_MSG_ERROR([option '--with-nlsdir' is deprecated, please use autoconf's standard '--localedir' instead])])
menutextdomain=
AC_ARG_WITH(menu-textdomain, AS_HELP_STRING([--with-menu-textdomain=DOMAIN], [specify gettext domain used for menu translations]),
[if test "x$withval" != "xno"; then
menutextdomain=$withval
fi])
AC_SUBST(menutextdomain)
AC_SUBST(NLSDIR)
dnl ===========================================
dnl Stuff that uses X
dnl ===========================================

View File

@@ -114,6 +114,43 @@ The installation directory can be changed with the standard option @option{--loc
@file{@emph{<prefix>}/share/locale/@emph{<lang>}/LC_MESSAGES}).
@c ---------------------------------------------------------------------- Translations for Menus ---
@section Translations for Menus
In order to propose an @emph{Application Menu} (also called @emph{Root Menu}) that is also
translated in the language of the interface, @sc{Window Maker} implements two complementary
mechanisms:
The first, always enabled when i18n support is enabled, is to look for the menu file containing the
name of the locale.
For example, if the file is called @file{menu} and the language is set as @env{LANG=fr_FR.utf-8},
then @sc{Window Maker} will search for, and use the first match found:
@itemize
@item @code{menu.fr_FR.utf-8}
@item @code{menu.fr_FR}
@item @code{menu.fr}
@item @code{menu}
@end itemize
The second possibility, which is not enabled by default, is to be able to use a custom @file{po}
file which contains the translations for the text of the menu.
This feature is enabled at compile time, using the option @option{--with-menu-textdomain} to the
@command{configure} script. For example, if you specify:
@example
./configure --with-menu-textdomain=WMMenu
@end example
@noindent then the translations for the menu will be searched in the file @file{WMMenu.mo} located
at the standard location, the default path being
@file{@emph{<prefix>}/share/locale/@emph{<lang>}/LC_MESSAGES/@emph{WMMenu}.mo}.
If you do not enable the feature (the default behaviour, or with an explicit
@option{--without-menu-textdomain}), then @sc{Window Maker} will @b{not} try to translate the
strings, even using its own domain file (@file{WindowMaker.mo}).
@c --------------------------------------------------------------------- LINGUAS at system level ---
@section Setting @env{LINGUAS} at system level

View File

@@ -113,3 +113,25 @@ AS_IF([test "x$XGETTEXT" != "x"],
XGETTEXT=""]))
AM_CONDITIONAL([HAVE_XGETTEXT], [test "x$XGETTEXT" != "x"])dnl
])
# WM_I18N_MENUTEXTDOMAIN
# ----------------------
#
# This option allows user to define a special Domain for translating
# Window Maker's menus. This can be useful because distributions may
# wish to customize the menus, and thus can make them translatable
# with their own po/mo files without having to touch WMaker's stuff.
AC_DEFUN_ONCE([WM_I18N_MENUTEXTDOMAIN],
[AC_ARG_WITH([menu-textdomain],
[AS_HELP_STRING([--with-menu-textdomain=DOMAIN],
[specify gettext domain used for menu translations])],
[AS_CASE([$withval],
[yes], [AC_MSG_ERROR([you are supposed to give a domain name for '--with-menu-textdomain'])],
[no], [menutextdomain=""],
[menutextdomain="$withval"])],
[menutextdomain=""])
AS_IF([test "x$menutextdomain" != "x"],
[AC_DEFINE_UNQUOTED([MENU_TEXTDOMAIN], ["$menutextdomain"],
[gettext domain to be used for menu translations]) ])
])