summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-05-23 15:22:48 +0000
committerDana Jansens <danakj@orodu.net>2002-05-23 15:22:48 +0000
commitbbbe226ccc7086721ba5e652fa89e6e8190adb56 (patch)
treead8e0503befcc10fcf855dee3d15b4949000f1a2 /src
parente7c332a586280ac1ea9d0f993d637802d64c9f87 (diff)
refix i18n for --disable-nls
Diffstat (limited to 'src')
-rw-r--r--src/i18n.cc23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/i18n.cc b/src/i18n.cc
index b31dd5a3..718ee4e7 100644
--- a/src/i18n.cc
+++ b/src/i18n.cc
@@ -46,7 +46,6 @@ extern "C" {
}
#include <string>
-using std::string;
#include "i18n.h"
@@ -89,15 +88,11 @@ I18n::~I18n() {
#if defined(NLS) && defined(HAVE_CATOPEN)
void I18n::openCatalog(const char *catalog) {
- int lp = strlen(LOCALEPATH), lc = strlen(locale),
- ct = strlen(catalog), len = lp + lc + ct + 3;
- catalog_filename = new char[len];
-
- strncpy(catalog_filename, LOCALEPATH, lp);
- *(catalog_filename + lp) = '/';
- strncpy(catalog_filename + lp + 1, locale, lc);
- *(catalog_filename + lp + lc + 1) = '/';
- strncpy(catalog_filename + lp + lc + 2, catalog, ct + 1);
+ std::string catalog_filename = LOCALEPATH;
+ catalog_filename += '/';
+ catalog_filename += locale;
+ catalog_filename += '/';
+ catalog_filename += catalog;
# ifdef MCLoadBySet
catalog_fd = catopen(catalog_filename.c_str(), MCLoadBySet);
@@ -108,22 +103,20 @@ void I18n::openCatalog(const char *catalog) {
if (catalog_fd == (nl_catd) -1)
fprintf(stderr, "failed to open catalog, using default messages\n");
}
-#else // !HAVE_CATOPEN
+#else
void I18n::openCatalog(const char *) {
- catalog_filename = (char *) 0;
}
#endif // HAVE_CATOPEN
-
#if defined(NLS) && defined(HAVE_CATGETS)
-const char *I18n::getMessage(int set, int msg, const char *msgString) const {
+const char* I18n::operator()(int set, int msg, const char *msgString) const {
if (catalog_fd != (nl_catd) -1)
return catgets(catalog_fd, set, msg, msgString);
else
return msgString;
}
#else
-const char *I18n::getMessage(int, int, const char *msgString) const {
+const char* I18n::operator()(int, int, const char *msgString) const {
return msgString;
}
#endif