summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-06-15 10:54:09 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-06-17 07:23:24 -0400
commitad4e495fa434f72de37846704cb08bacac3c52da (patch)
treee2327aca6935c1e3bc726b880a70a4e666bab667
parent7d2f248b39aa78eaa7708ce64ad146d5a8bb934c (diff)
downloadsssd-ad4e495fa434f72de37846704cb08bacac3c52da.tar.gz
sssd-ad4e495fa434f72de37846704cb08bacac3c52da.tar.bz2
sssd-ad4e495fa434f72de37846704cb08bacac3c52da.zip
Create gettext framework for SSSD daemon
-rw-r--r--.gitignore1
-rw-r--r--server/Makefile.am7
-rw-r--r--server/configure.ac4
-rw-r--r--server/po/LINGUAS1
-rw-r--r--server/po/Makevars41
-rw-r--r--server/po/POTFILES.in9
-rw-r--r--server/po/es.po22
-rw-r--r--server/po/sss_daemon.pot22
-rw-r--r--server/tools/sss_groupadd.c4
-rw-r--r--server/tools/sss_groupdel.c4
-rw-r--r--server/tools/sss_groupmod.c4
-rw-r--r--server/tools/sss_useradd.c7
-rw-r--r--server/tools/sss_userdel.c4
-rw-r--r--server/tools/sss_usermod.c4
-rw-r--r--server/tools/tools_util.c20
-rw-r--r--server/tools/tools_util.h4
-rw-r--r--server/util/server.c6
-rw-r--r--server/util/sssd-i18n.h8
-rw-r--r--sssd.spec.in1
19 files changed, 158 insertions, 15 deletions
diff --git a/.gitignore b/.gitignore
index d0daf658..c6cb77bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,4 @@ stamp-po
ABOUT-NLS
build
*.patch
+*.swp
diff --git a/server/Makefile.am b/server/Makefile.am
index 0c5f4674..45f5eec5 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -1,3 +1,4 @@
+SUBDIRS = po
topdir=.
sssdlibexecdir = $(libexecdir)/sssd
sssdlibdir = $(libdir)/sssd
@@ -122,7 +123,10 @@ AM_CPPFLAGS = -Wall \
-DSHADOW_UTILS_PATH=\"$(shadow_utils_path)\" \
-DSSSD_INTROSPECT_PATH=\"$(dbusinstropectdir)\" \
-DSSSD_CONF_DIR=\"$(sssdconfdir)\" \
- -DUSE_MMAP=1
+ -DUSE_MMAP=1 \
+ -DLOCALEDIR=\"\$(localedir)\"
+
+EXTRA_DIST = build/config.rpath
SSSD_DEBUG_OBJ = \
util/debug.c
@@ -175,6 +179,7 @@ dist_noinst_HEADERS = \
util/btreemap.h \
util/nss_sha512crypt.h \
util/dlinklist.h \
+ util/sssd-i18n.h \
util/util.h \
config.h \
monitor/monitor.h \
diff --git a/server/configure.ac b/server/configure.ac
index a1060c11..77f7ec73 100644
--- a/server/configure.ac
+++ b/server/configure.ac
@@ -20,6 +20,8 @@ AM_PROG_CC_C_O
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_CONFIG_MACRO_DIR([m4])
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.17])
m4_pattern_allow([AM_SILENT_RULES])
AM_SILENT_RULES
@@ -84,6 +86,6 @@ AC_SUBST(EXTRA_OBJ)
AC_CHECK_HEADERS([sys/inotify.h])
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile po/Makefile.in])
AC_OUTPUT
diff --git a/server/po/LINGUAS b/server/po/LINGUAS
new file mode 100644
index 00000000..8357fcaa
--- /dev/null
+++ b/server/po/LINGUAS
@@ -0,0 +1 @@
+es
diff --git a/server/po/Makevars b/server/po/Makevars
new file mode 100644
index 00000000..5dda6915
--- /dev/null
+++ b/server/po/Makevars
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
+# package. (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.) Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright. The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Red Hat, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+# in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+# understood.
+# - Strings which make invalid assumptions about notation of date, time or
+# money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = freeipa-devel@redhat.com
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used. It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/server/po/POTFILES.in b/server/po/POTFILES.in
new file mode 100644
index 00000000..8de37f6b
--- /dev/null
+++ b/server/po/POTFILES.in
@@ -0,0 +1,9 @@
+# List of source files which contain translatable strings.
+confdb/confdb_setup.c
+tools/sss_groupdel.c
+tools/sss_groupmod.c
+tools/sss_userdel.c
+tools/tools_util.c
+tools/sss_useradd.c
+tools/sss_groupadd.c
+tools/sss_usermod.c
diff --git a/server/po/es.po b/server/po/es.po
new file mode 100644
index 00000000..53320395
--- /dev/null
+++ b/server/po/es.po
@@ -0,0 +1,22 @@
+# English translations for sss_daemon package.
+# Copyright (C) 2009 Red Hat, Inc.
+# This file is distributed under the same license as the sss_daemon package.
+# Automatically generated, 2009.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: sss_daemon 0.4.0\n"
+"Report-Msgid-Bugs-To: freeipa-devel@redhat.com\n"
+"POT-Creation-Date: 2009-06-15 10:21-0400\n"
+"PO-Revision-Date: 2009-06-15 10:21-0400\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+#: tools/sss_useradd.c:484
+#, c-format
+msgid "The user %s already exists\n"
+msgstr "The user %s already exists\n"
diff --git a/server/po/sss_daemon.pot b/server/po/sss_daemon.pot
new file mode 100644
index 00000000..73457d07
--- /dev/null
+++ b/server/po/sss_daemon.pot
@@ -0,0 +1,22 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR Red Hat, Inc.
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: sss_daemon 0.4.0\n"
+"Report-Msgid-Bugs-To: freeipa-devel@redhat.com\n"
+"POT-Creation-Date: 2009-06-15 10:21-0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: tools/sss_useradd.c:484
+#, c-format
+msgid "The user %s already exists\n"
+msgstr ""
diff --git a/server/tools/sss_groupadd.c b/server/tools/sss_groupadd.c
index 5e1aeb9b..eb7b3d8f 100644
--- a/server/tools/sss_groupadd.c
+++ b/server/tools/sss_groupadd.c
@@ -134,9 +134,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if(ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_groupdel.c b/server/tools/sss_groupdel.c
index 8e07febf..31587107 100644
--- a/server/tools/sss_groupdel.c
+++ b/server/tools/sss_groupdel.c
@@ -127,9 +127,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if(ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_groupmod.c b/server/tools/sss_groupmod.c
index e2c59cba..d6c19152 100644
--- a/server/tools/sss_groupmod.c
+++ b/server/tools/sss_groupmod.c
@@ -254,9 +254,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if (ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_useradd.c b/server/tools/sss_useradd.c
index a01cd7f8..84f38fa6 100644
--- a/server/tools/sss_useradd.c
+++ b/server/tools/sss_useradd.c
@@ -31,6 +31,7 @@
#include "util/util.h"
#include "db/sysdb.h"
#include "tools/tools_util.h"
+#include "util/sssd-i18n.h"
/* Define default command strings if not redefined by user */
#ifndef USERADD
@@ -335,9 +336,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if (ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
@@ -480,7 +481,7 @@ int main(int argc, const char **argv)
ret = user_ctx->error;
switch (ret) {
case EEXIST:
- DEBUG(0, ("The user %s already exists\n", user_ctx->username));
+ DEBUG(0, (_("The user %s already exists\n"), user_ctx->username));
break;
default:
diff --git a/server/tools/sss_userdel.c b/server/tools/sss_userdel.c
index 713c9383..e374b14b 100644
--- a/server/tools/sss_userdel.c
+++ b/server/tools/sss_userdel.c
@@ -126,9 +126,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if(ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/sss_usermod.c b/server/tools/sss_usermod.c
index d19fe9d8..a5eadce2 100644
--- a/server/tools/sss_usermod.c
+++ b/server/tools/sss_usermod.c
@@ -322,9 +322,9 @@ int main(int argc, const char **argv)
debug_prg_name = argv[0];
- ret = setup_db(&ctx);
+ ret = init_sss_tools(&ctx);
if (ret != EOK) {
- DEBUG(0, ("Could not set up database\n"));
+ DEBUG(0, ("Could not set up tools\n"));
ret = EXIT_FAILURE;
goto fini;
}
diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c
index 0f093cb8..15665d36 100644
--- a/server/tools/tools_util.c
+++ b/server/tools/tools_util.c
@@ -228,3 +228,23 @@ int parse_groups(TALLOC_CTX *mem_ctx, const char *optstr, char ***_out)
return EOK;
}
+int init_sss_tools(struct tools_ctx **ctx)
+{
+ int ret;
+ /* Set up LOCALE */
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
+ /* Connect to the database */
+ ret = setup_db(ctx);
+ if (ret != EOK) {
+ DEBUG(0, ("Could not set up database\n"));
+ ret = EXIT_FAILURE;
+ goto fini;
+ }
+
+ ret = EOK;
+fini:
+ return ret;
+}
diff --git a/server/tools/tools_util.h b/server/tools/tools_util.h
index e055fe23..7c66c119 100644
--- a/server/tools/tools_util.h
+++ b/server/tools/tools_util.h
@@ -1,6 +1,8 @@
#ifndef __TOOLS_UTIL_H__
#define __TOOLS_UTIL_H__
+#include "util/sssd-i18n.h"
+
#define UID_NOT_SET 0
#define GID_NOT_SET 0
@@ -36,6 +38,8 @@ struct tools_ctx {
struct sss_domain_info *domains;
};
+int init_sss_tools(struct tools_ctx **ctx);
+
int setup_db(struct tools_ctx **ctx);
void usage(poptContext pc, const char *error);
diff --git a/server/util/server.c b/server/util/server.c
index 7c1c927f..4dfd18ef 100644
--- a/server/util/server.c
+++ b/server/util/server.c
@@ -29,6 +29,7 @@
#include <fcntl.h>
#include <unistd.h>
#include "util/util.h"
+#include "util/sssd-i18n.h"
#include "ldb.h"
#include "confdb/confdb.h"
@@ -280,6 +281,11 @@ int server_setup(const char *name, int flags,
}
}
+ /* Set up locale */
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
/* the event context is the top level structure.
* Everything else should hang off that */
event_ctx = tevent_context_init(talloc_autofree_context());
diff --git a/server/util/sssd-i18n.h b/server/util/sssd-i18n.h
new file mode 100644
index 00000000..74f9bec0
--- /dev/null
+++ b/server/util/sssd-i18n.h
@@ -0,0 +1,8 @@
+#ifndef _SSSD_I18N_H
+#define _SSSD_I18N_H
+
+#include <libintl.h>
+#define _(STRING) gettext (STRING)
+#include "config.h"
+
+#endif
diff --git a/sssd.spec.in b/sssd.spec.in
index e325de3b..20535764 100644
--- a/sssd.spec.in
+++ b/sssd.spec.in
@@ -108,6 +108,7 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man5/*
%{_mandir}/man8/*
%{_datadir}/locale/*/LC_MESSAGES/sss_client.mo
+%{_datadir}/locale/*/LC_MESSAGES/sss_daemon.mo
%post
/sbin/ldconfig