summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/catalog.d12
-rwxr-xr-xsrc/helloworld.d2
3 files changed, 9 insertions, 7 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 92d8df8..7a990f3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,7 +11,7 @@ libtestlibrary_a_SOURCES = testlibrary.d
bin_PROGRAMS = helloworld
helloworld_SOURCES = helloworld.d catalog.d
-helloworld_LDADD = $(DEPS_LIBS) $(top_srcdir)/config.d libtestlibrary.a testshlibrary.d libtestshlibrary.la
+helloworld_LDADD = $(DEPS_LIBS) $(top_srcdir)/config.d libtestlibrary.a testshlibrary.d libtestshlibrary.la -lunwind
DFLAGS += -I$(top_srcdir) -I$(srcdir)
diff --git a/src/catalog.d b/src/catalog.d
index 415b34f..fae44ac 100644
--- a/src/catalog.d
+++ b/src/catalog.d
@@ -2,16 +2,18 @@ module catalog;
import std.string;
-private static extern (C) char* bindtextdomain(char* domainname, char* localedir);
-private static extern (C) char* bind_textdomain_codeset(char* domainname, char* localedir);
-private static extern (C) char* textdomain(char* domainname);
-private static extern (C) char* gettext(char* instring);
-private static extern (C) char* ngettext(char* singular, char* plural, int n);
+static extern (C) char* setlocale(int category, char* locale);
+static extern (C) char* bindtextdomain(char* domainname, char* localedir);
+static extern (C) char* bind_textdomain_codeset(char* domainname, char* localedir);
+static extern (C) char* textdomain(char* domainname);
+static extern (C) char* gettext(char* instring);
+static extern (C) char* ngettext(char* singular, char* plural, int n);
public static class Catalog
{
public static void Init(char[] packageid, char[] localedir)
{
+ setlocale(6, "");
bindtextdomain(std.string.toStringz(packageid), std.string.toStringz(localedir));
bind_textdomain_codeset(std.string.toStringz(packageid), "UTF-8");
textdomain(std.string.toStringz(packageid));
diff --git a/src/helloworld.d b/src/helloworld.d
index db25741..dcb4a37 100755
--- a/src/helloworld.d
+++ b/src/helloworld.d
@@ -7,7 +7,7 @@ import catalog;
void main(char[][] args)
{
// Internationalization Example
- Catalog.Init("i18n","./locale");
+ Catalog.Init(config.PACKAGE, config.PACKAGE_LOCALE_DIR);
writefln(Catalog.GetString("Hello!"));