8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 09:23:03 +01:00

Make LC_MESSAGES env var work as expected (get only filename) for an alternative messages file held in the INTL dir.

This commit is contained in:
robocop 2006-06-08 05:02:34 +00:00
parent de8a30d57c
commit 991de0b29e
2 changed files with 9 additions and 1 deletions

View File

@ -91,7 +91,7 @@ static const char* LOGFILE = "firebird.log";
#elif defined(WIN_NT) #elif defined(WIN_NT)
static const char* WORKFILE = "c:\\temp\\"; static const char* WORKFILE = "c:\\temp\\";
static const char* MSG_FILE = "firebird.msg"; static const char* MSG_FILE = "firebird.msg";
static const char MSG_FILE_LANG[]= "intl/%.8s.msg"; static const char MSG_FILE_LANG[]= "intl\\%.8s.msg";
const int LOCALE_MAX = 6; const int LOCALE_MAX = 6;
static const char* LOGFILE = "firebird.log"; static const char* LOGFILE = "firebird.log";
#elif defined(VMS) #elif defined(VMS)

View File

@ -1484,6 +1484,13 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle,
if (fb_utils::readenv("LC_MESSAGES", p)) if (fb_utils::readenv("LC_MESSAGES", p))
{ {
sanitize(p); sanitize(p);
Firebird::string::size_type pos = p.find_last_of('/');
if (pos == Firebird::string::npos)
pos = p.find_last_of('\\');
if (pos != Firebird::string::npos)
p.erase(0, pos + 1);
fb_utils::snprintf(translated_msg_file, fb_utils::snprintf(translated_msg_file,
sizeof(translated_msg_file), MSG_FILE_LANG, p.c_str()); sizeof(translated_msg_file), MSG_FILE_LANG, p.c_str());
gds__prefix_msg(msg_file, translated_msg_file); gds__prefix_msg(msg_file, translated_msg_file);
@ -1493,6 +1500,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void* handle,
} }
else else
status = 1; status = 1;
if (status) { if (status) {
/* Default to standard message file */ /* Default to standard message file */