summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar mszulecki2007-06-10 21:38:00 +0000
committerGravatar mszulecki2007-06-10 21:38:00 +0000
commitef14adf712b23fce2867a4df9aa6af26ff34e58e (patch)
tree404e0ff275dcb1689668497e1eff91c7ba99deed /src
parent5a424fb57eced532f61e7b3bd33e812313c915f1 (diff)
downloaddskel-ef14adf712b23fce2867a4df9aa6af26ff34e58e.tar.gz
dskel-ef14adf712b23fce2867a4df9aa6af26ff34e58e.tar.bz2
Implement intl support.
git-svn-id: http://svn.sukimashita.com/repos/dskel/trunk@20 4281df72-ff29-0410-8fee-2d9ac0c5f5a7
Diffstat (limited to 'src')
-rw-r--r--src/catalog.d18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/catalog.d b/src/catalog.d
index fd60545..415b34f 100644
--- a/src/catalog.d
+++ b/src/catalog.d
@@ -1,19 +1,29 @@
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);
+
public static class Catalog
{
public static void Init(char[] packageid, char[] localedir)
{
-
+ bindtextdomain(std.string.toStringz(packageid), std.string.toStringz(localedir));
+ bind_textdomain_codeset(std.string.toStringz(packageid), "UTF-8");
+ textdomain(std.string.toStringz(packageid));
}
public static char[] GetString(char[] s)
{
- return s;
+ return std.string.toString(gettext(std.string.toStringz(s)));
}
- public static char[] GetPluralString(char[] s, char[] p, char[] n)
+ public static char[] GetPluralString(char[] s, char[] p, int n)
{
- return s;
+ return std.string.toString(ngettext(std.string.toStringz(s), std.string.toStringz(p), n));
}
}