aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--USER/USER.xs28
2 files changed, 16 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index 79e8e05..6b378d8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- make libuser binding i18n aware
- refactorization for readability (please test)
- use libuser translations
diff --git a/USER/USER.xs b/USER/USER.xs
index edfecb4..64b30dc 100644
--- a/USER/USER.xs
+++ b/USER/USER.xs
@@ -30,6 +30,8 @@
#include <libuser/user.h>
#include <libuser/user_private.h>
+
+
#define INVALID (-0x80000000)
#ifndef _
#define _(String) gettext(String)
@@ -485,7 +487,7 @@ Admin_UserAdd(self, ent, is_system, dont_create_home)
GValue *value;
/* GMOT (Great Moment Of Truth) */
if (lu_user_add(self, ent, &error) == FALSE) {
- croak("Account creation failed: %s.\n", error ? error->string : "Unknown error");
+ croak(_("Account creation failed: '%s'.\n"), error ? error->string : "Unknown error");
RETVAL = 0;
} else RETVAL = 1 ;
if (!dont_create_home) {
@@ -498,7 +500,7 @@ Admin_UserAdd(self, ent, is_system, dont_create_home)
if (G_VALUE_HOLDS_STRING(value)) {
uidNumber = atol(g_value_get_string(value));
} else {
- warn("Cannot get Uid number");
+ warn(_("Cannot get Uid number"));
}
/* Read the user's GID. */
@@ -510,7 +512,7 @@ Admin_UserAdd(self, ent, is_system, dont_create_home)
if (G_VALUE_HOLDS_STRING(value)) {
gidNumber = atol(g_value_get_string(value));
} else {
- warn("Cannot retrieve val");
+ warn(_("Cannot retrieve val"));
}
/* Read the user's home directory. */
@@ -521,7 +523,7 @@ Admin_UserAdd(self, ent, is_system, dont_create_home)
if (lu_homedir_populate(skeleton, homeDirectory,
uidNumber, gidNumber, 0700,
&error) == 0) {
- warn("Error creating %s: %s.\n", homeDirectory, error ? error->string : "unknown error");
+ warn(_("Error creating `%s': %s"), homeDirectory, error ? error->string : "unknown error");
RETVAL = 2;
}
@@ -577,7 +579,7 @@ Admin_UserModify(self, ent)
PPCODE:
USER__ERR *error = NULL;
if (lu_user_modify(self, ent, &error) == FALSE) {
- croak("User could not be modified %s.\n", error ? error->string : "Unknown error");
+ croak(_("User could not be modified: '%s'.\n"), error ? error->string : "Unknown error");
}
int
@@ -587,7 +589,7 @@ Admin_UserDel(self, ent)
CODE:
USER__ERR *error = NULL;
if (lu_user_delete(self, ent, &error) == FALSE) {
- croak("User Could Not be deleted: %s.\n", error ? error->string : "Unknown error");
+ croak(_("User Could Not be deleted: '%s'.\n"), error ? error->string : "Unknown error");
RETVAL = 0;
} else RETVAL = 1 ;
OUTPUT:
@@ -613,7 +615,7 @@ Admin_UserSetPass(self, ent, userPasswd)
USER__ERR *error = NULL;
gboolean crypted = FALSE;
if (lu_user_setpass(self, ent, userPasswd, crypted, &error) == FALSE) {
- croak("Failed to set password %s.\n", error ? error->string : _("unknown error"));
+ croak(_("Failed to set password: '%s'.\n"), error ? error->string : _("unknown error"));
if (error) { lu_error_free(&error); }
}
@@ -680,7 +682,7 @@ Admin_GroupAdd(self, ent)
PPCODE:
USER__ERR *error = NULL;
if (lu_group_add(self, ent, &error) == FALSE) {
- warn("Group creation failed.\n");
+ warn(_("Group creation failed.\n"));
}
void
@@ -690,7 +692,7 @@ Admin_GroupModify(self, ent)
PPCODE:
USER__ERR *error = NULL;
if (lu_group_modify(self, ent, &error) == FALSE) {
- croak("Group could not be modified %s.\n", error ? error->string : "Unknown error");
+ croak(_("Group could not be modified: '%s'.\n"), error ? error->string : "Unknown error");
}
int
@@ -700,7 +702,7 @@ Admin_GroupDel(self, ent)
CODE:
USER__ERR *error = NULL;
if (lu_group_delete(self, ent, &error) == FALSE) {
- croak("Group could not be deleted: %s.\n", error ? error->string : "Unknown error");
+ croak(_("Group could not be deleted: '%s'.\n"), error ? error->string : "Unknown error");
RETVAL = 0;
} else RETVAL = 1 ;
OUTPUT:
@@ -858,15 +860,15 @@ Admin_CleanHome(self, ent)
const char *tmp = NULL;
values = lu_ent_get(ent, LU_HOMEDIRECTORY);
if ((values == NULL) || (values->n_values == 0)) {
- warn("No home directory for the user.\n");
+ warn(_("No home directory for the user.\n"));
} else {
value = g_value_array_get_nth(values, 0);
tmp = g_value_get_string(value);
if (lu_homedir_remove(tmp, &error) == FALSE) {
if (error->code == lu_error_stat)
- warn("Home Directory Could Not be deleted: %s.\n", error ? error->string : "Unknown error");
+ warn(_("Home Directory Could Not be deleted: '%s'.\n"), error ? error->string : "Unknown error");
else
- croak("Home Directory Could Not be deleted: %s.\n", error ? error->string : "Unknown error");
+ croak(_("Home Directory Could Not be deleted: '%s'.\n"), error ? error->string : "Unknown error");
}
}