diff options
author | Chyla Zbigniew <chyla@src.gnome.org> | 2001-08-25 06:18:06 +0800 |
---|---|---|
committer | Chyla Zbigniew <chyla@src.gnome.org> | 2001-08-25 06:18:06 +0800 |
commit | b74947b0a0adc405938f3ec720e9ea6e1904de94 (patch) | |
tree | 136bec27ae574c965dbe531f0716b4318a332eae /e-util/e-unicode-i18n.c | |
parent | 17a85e8669435d6ad7d1fafe507288fee88e8122 (diff) | |
download | gsoc2013-evolution-b74947b0a0adc405938f3ec720e9ea6e1904de94.tar.gz gsoc2013-evolution-b74947b0a0adc405938f3ec720e9ea6e1904de94.tar.zst gsoc2013-evolution-b74947b0a0adc405938f3ec720e9ea6e1904de94.zip |
Added e-unicode-i18n.c and e-unicode-i18n.h.
* Makefile.am (libeutil_la_SOURCES): Added e-unicode-i18n.c and
e-unicode-i18n.h.
* e-unicode-i18n.[ch]: New files with two extra functions
(e_utf8_gettext, e_utf8_dgettext) and U_() macro.
Should be used instead of _() if we need UTF-8 string.
svn path=/trunk/; revision=12459
Diffstat (limited to 'e-util/e-unicode-i18n.c')
-rw-r--r-- | e-util/e-unicode-i18n.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/e-util/e-unicode-i18n.c b/e-util/e-unicode-i18n.c new file mode 100644 index 0000000000..94cf05ecd9 --- /dev/null +++ b/e-util/e-unicode-i18n.c @@ -0,0 +1,59 @@ +/* + * e-unicode-i18n.c + * + * Author: Zbigniew Chyla <cyba@gnome.pl> + * + * Copyright (C) 2001 Ximian, Inc. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <glib.h> +#include <gal/widgets/e-unicode.h> +#include "e-unicode-i18n.h" + +static GHashTable *locale_to_utf8_hash = NULL; + +static const char * +locale_to_utf8 (const char *string) +{ + char *utf; + + if (locale_to_utf8_hash == NULL) { + locale_to_utf8_hash = g_hash_table_new (&g_str_hash, &g_str_equal); + } + + utf = g_hash_table_lookup (locale_to_utf8_hash, string); + if (utf == NULL) { + utf = e_utf8_from_locale_string (string); + g_hash_table_insert (locale_to_utf8_hash, g_strdup (string), utf); + } + + return utf; +} + +const char * +e_utf8_gettext (const char *string) +{ + if (string == NULL) { + return NULL; + } else if (string[0] == '\0') { + return ""; + } else { + return locale_to_utf8 (gettext (string)); + } +} + +const char * +e_utf8_dgettext (const char *domain, const char *string) +{ + if (string == NULL) { + return NULL; + } else if (string[0] == '\0') { + return ""; + } else { + return locale_to_utf8 (dgettext (domain, string)); + } +} |