split some files out from 'language' to 'gettext'

This commit is contained in:
Dave White 2004-08-21 14:19:38 +00:00
parent 69b26c8892
commit 69010899d6
5 changed files with 32 additions and 21 deletions

View file

@ -45,6 +45,7 @@ wesnoth_SOURCES = about.cpp \
game_config.cpp \
game_events.cpp \
gamestatus.cpp \
gettext.cpp \
halo.cpp \
help.cpp \
hotkeys.cpp \
@ -113,6 +114,7 @@ wesnoth_SOURCES = about.cpp \
game_config.hpp \
game_events.hpp \
gamestatus.hpp \
gettext.hpp \
halo.hpp \
help.hpp \
hotkeys.hpp \
@ -192,6 +194,7 @@ wesnoth_editor_SOURCES = editor/editor.cpp \
game_config.cpp \
game_events.cpp \
gamestatus.cpp \
gettext.cpp \
halo.cpp \
help.cpp \
hotkeys.cpp \
@ -258,6 +261,7 @@ wesnoth_editor_SOURCES = editor/editor.cpp \
game_config.hpp \
game_events.hpp \
gamestatus.hpp \
gettext.hpp \
halo.hpp \
help.hpp \
hotkeys.hpp \

16
src/gettext.cpp Normal file
View file

@ -0,0 +1,16 @@
#include "gettext.hpp"
#include <cstring>
const char* sgettext (const char *msgid)
{
const char *msgval = gettext (msgid);
if (msgval == msgid) {
msgval = strrchr (msgid, '|');
if (msgval == NULL)
msgval = msgid;
else
msgval++;
}
return msgval;
}

11
src/gettext.hpp Normal file
View file

@ -0,0 +1,11 @@
#ifndef GETTEXT_HPP_INCLUDED
#define GETTEXT_HPP_INCLUDED
// gettext-related declarations
#include <libintl.h>
const char* sgettext (const char*);
#define _(String) gettext(String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
#endif

View file

@ -352,16 +352,3 @@ wide_string string_to_wstring(const std::string &src)
{
return utf8_to_wstring(src);
}
const char* sgettext (const char *msgid)
{
const char *msgval = gettext (msgid);
if (msgval == msgid) {
msgval = strrchr (msgid, '|');
if (msgval == NULL)
msgval = msgid;
else
msgval++;
}
return msgval;
}

View file

@ -14,6 +14,7 @@
#define LANGUAGE_HPP_INCLUDED
#include "config.hpp"
#include "gettext.hpp"
#include <map>
#include <string>
@ -76,12 +77,4 @@ std::string wstring_to_string(const wide_string &);
wide_string string_to_wstring(const std::string &);
std::string wchar_to_string(const wchar_t);
// gettext-related declarations
#include <libintl.h>
const char* sgettext (const char*);
#define _(String) gettext(String)
#define gettext_noop(String) String
#define N_(String) gettext_noop (String)
#endif