Added gettext support for pam and nslcd#64
Open
tsaarni wants to merge 1 commit intoarthurdejong:masterfrom
Open
Added gettext support for pam and nslcd#64tsaarni wants to merge 1 commit intoarthurdejong:masterfrom
tsaarni wants to merge 1 commit intoarthurdejong:masterfrom
Conversation
9c7e445 to
a4f039e
Compare
Author
|
I'm dropping gettext.h wrapper that GNU gettext project offers to be included in projects (link). CodeQL reported critical finding which I'm not 100% sure about it ("May return stack-allocated memory from msg_ctxt_id" here), the header is relatively complicated, and I'm not sure why it would be needed in the first place. Are there real portability or other problems it addresses? For now, I replace it with simple macro that directly maps |
b5eb63f to
c3e8f81
Compare
3751e9c to
a9768bd
Compare
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
Author
|
I have rebased this PR on top of master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.amthat 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 casePACKAGEi.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-ldapdare 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.