summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/context.c
diff options
context:
space:
mode:
authorKarel Zak2017-04-25 17:05:09 +0200
committerKarel Zak2017-04-25 17:05:09 +0200
commit7095232d21232ca1ab307fbdd1a36471347f23c6 (patch)
tree3ad718b1bcd33acdebfecd955b0fdcc9824e19c3 /libfdisk/src/context.c
parentlsblk: don't duplicate columns (diff)
downloadkernel-qcow2-util-linux-7095232d21232ca1ab307fbdd1a36471347f23c6.tar.gz
kernel-qcow2-util-linux-7095232d21232ca1ab307fbdd1a36471347f23c6.tar.xz
kernel-qcow2-util-linux-7095232d21232ca1ab307fbdd1a36471347f23c6.zip
libfdisk: fix NLS support
The current libfdisk code uses gettext() to translate strings. It means it follows the default text domain (as set by textdomain(3) usually in the main program). This is useless for public shared library. We have call private bindtextdomain() and use dgettext() with private domain name to be independent on the main program. For this purpose include/nls.h supports UL_TEXTDOMAIN_EXPLICIT to use dgettext(). Note that libfdisk will continue to use util-linux.po, rather than keep the texts in the separate file. The nls.h has to be included only from fdiskP.h to be sure that nls.h works as expected for the library. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/context.c')
-rw-r--r--libfdisk/src/context.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c
index 5ea8dccd4..7dc16aa78 100644
--- a/libfdisk/src/context.c
+++ b/libfdisk/src/context.c
@@ -61,6 +61,8 @@ struct fdisk_context *fdisk_new_context(void)
cxt->labels[ cxt->nlabels++ ] = fdisk_new_sgi_label(cxt);
cxt->labels[ cxt->nlabels++ ] = fdisk_new_sun_label(cxt);
+ bindtextdomain(LIBFDISK_TEXTDOMAIN, LOCALEDIR);
+
return cxt;
}