I18N L10N - Subst

- Localized strings in Subst.
This commit is contained in:
Paul Beckingham 2009-06-07 00:46:58 -04:00
parent 049767484f
commit ffa0c6e758
3 changed files with 17 additions and 3 deletions

View file

@ -22,6 +22,9 @@
109 Empty record in input
110 Unrecognized characters at end of line
111 Record not recognized as format 4
112 Cannot substitute an empty string
113 Unrecognized character(s) at end of substitution
114 Malformed substitution
# 2xx Commands
200 active

View file

@ -27,6 +27,10 @@
#include "Subst.h"
#include "Nibbler.h"
#include "Context.h"
#include "i18n.h"
extern Context context;
////////////////////////////////////////////////////////////////////////////////
Subst::Subst ()
@ -99,13 +103,16 @@ void Subst::parse (const std::string& input)
mGlobal = n.skip ('g');
if (mFrom == "")
throw std::string ("Cannot substitute an empty string");
throw context.stringtable.get (SUBST_EMPTY,
"Cannot substitute an empty string");
if (!n.depleted ())
throw std::string ("Unrecognized character(s) at end of substitution");
throw context.stringtable.get (SUBST_BAD_CHARS,
"Unrecognized character(s) at end of substitution");
}
else
throw std::string ("Malformed substitution");
throw context.stringtable.get (SUBST_MALFORMED,
"Malformed substitution");
}
////////////////////////////////////////////////////////////////////////////////

View file

@ -46,6 +46,10 @@
#define RECORD_EXTRA 110
#define RECORD_NOT_FF4 111
#define SUBST_EMPTY 112
#define SUBST_BAD_CHARS 113
#define SUBST_MALFORMED 114
// 2xx Commands
#define CMD_ACTIVE 200
#define CMD_ADD 201