From ffa0c6e7580f385e0ffc04a223b26f4c3bcebd79 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 7 Jun 2009 00:46:58 -0400 Subject: [PATCH] I18N L10N - Subst - Localized strings in Subst. --- i18n/strings.en-US | 3 +++ src/Subst.cpp | 13 ++++++++++--- src/i18n.h | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/i18n/strings.en-US b/i18n/strings.en-US index 7a373c1b4..1c2526fc1 100644 --- a/i18n/strings.en-US +++ b/i18n/strings.en-US @@ -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 diff --git a/src/Subst.cpp b/src/Subst.cpp index 93840c112..a2f83bec1 100644 --- a/src/Subst.cpp +++ b/src/Subst.cpp @@ -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"); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/i18n.h b/src/i18n.h index c6da57fe3..36186f60a 100644 --- a/src/i18n.h +++ b/src/i18n.h @@ -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