Added gettext support for pam and nslcd #64
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds optional support for internationalization for the PAM module and nslcd. The feature is enabled by new flag
./configure --enable-nls
. The feature is disabled by default. When disabled the change no-op - the function calls to translate strings_("my message")
evaluates to simply"my message"
.Detailed notes for reviewers:
Gnu gettext comes with tool gettextize to prepare a project for internationalization, but I propose NOT using this tool in this case. If running gettextize, it will generate many scripts and modify quite many files in the project (see here: "Some of this infrastructure, namely ca. 20 Autoconf macro files and the config.rpath file, is also contained in Gnulib and may be imported by gnulib-tool.") adding overhead to the project. In my view is avoidable. Therefore, in this change I propose manually written
po/Makefile.am
that conceptually mimics "gettextized" project but with very simplistic approach.Call
_(msgid)
will forward tochar * dgettext (const char * domainname, const char * msgid)
which is a version ofgettext()
that request lookup from specific domainname (in this casePACKAGE
i.e.nss-pam-ldapd
) and not from the default domain in the currently running process.The program that runs the PAM modules might have set up default domain to something else, and we should not depend on, or change that. Therefore at initialization there is a call
bindtextdomain(PACKAGE, LOCALEDIR)
to instruct gettext where translation files for the domainnss-pam-ldapd
are found. Similar approach is used by Linux PAM.Nslcd as a standalone program requires setting locales.
The pull request includes localization for two languages as an example: Finnish and Swedish.
Closes #63.