summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar mszulecki2007-06-11 17:45:08 +0000
committerGravatar mszulecki2007-06-11 17:45:08 +0000
commitc6421dddc6ede5f92a4626899083e9eaece0f380 (patch)
tree3ee51096795f7da377c42b8737ba48fe403b8a5a /src
parentef14adf712b23fce2867a4df9aa6af26ff34e58e (diff)
downloaddskel-c6421dddc6ede5f92a4626899083e9eaece0f380.tar.gz
dskel-c6421dddc6ede5f92a4626899083e9eaece0f380.tar.bz2
Fix i18n functionality
git-svn-id: http://svn.sukimashita.com/repos/dskel/trunk@21 4281df72-ff29-0410-8fee-2d9ac0c5f5a7
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!"));