mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-27 19:17:19 +02:00
i18n
- Eliminated StringTable.{h,cpp}. - Eliminated strings.<locale> files. This is not the way to do it.
This commit is contained in:
parent
3cccdf722e
commit
c502f0216a
24 changed files with 99 additions and 807 deletions
|
@ -8,16 +8,15 @@ set (task_SRCS API.cpp API.h Att.cpp Att.h Cmd.cpp Cmd.h Color.cpp Color.h
|
|||
JSON.cpp JSON.h Keymap.cpp Keymap.h Lisp.cpp Lisp.h Location.cpp
|
||||
Location.h Nibbler.cpp Nibbler.h Path.cpp Path.h Permission.cpp
|
||||
Permission.h Record.cpp Record.h Rectangle.cpp Rectangle.h
|
||||
Sensor.cpp Sensor.h Sequence.cpp Sequence.h StringTable.cpp
|
||||
StringTable.h Subst.cpp Subst.h TDB.cpp TDB.h Table.cpp Table.h
|
||||
Task.cpp Task.h Taskmod.cpp Taskmod.h Thread.cpp Thread.h
|
||||
Timer.cpp Timer.h Transport.cpp Transport.h TransportSSH.cpp
|
||||
TransportSSH.h TransportRSYNC.cpp TransportRSYNC.h
|
||||
TransportCurl.cpp TransportCurl.h Tree.cpp Tree.h burndown.cpp
|
||||
command.cpp custom.cpp dependency.cpp diag.cpp edit.cpp
|
||||
export.cpp history.cpp i18n.h import.cpp interactive.cpp
|
||||
recur.cpp report.cpp rules.cpp rx.cpp rx.h text.cpp text.h
|
||||
utf8.cpp utf8.h util.cpp util.h Uri.cpp Uri.h)
|
||||
Sensor.cpp Sensor.h Sequence.cpp Sequence.h Subst.cpp Subst.h
|
||||
TDB.cpp TDB.h Table.cpp Table.h Task.cpp Task.h Taskmod.cpp
|
||||
Taskmod.h Thread.cpp Thread.h Timer.cpp Timer.h Transport.cpp
|
||||
Transport.h TransportSSH.cpp TransportSSH.h TransportRSYNC.cpp
|
||||
TransportRSYNC.h TransportCurl.cpp TransportCurl.h Tree.cpp
|
||||
Tree.h burndown.cpp command.cpp custom.cpp dependency.cpp
|
||||
diag.cpp edit.cpp export.cpp history.cpp i18n.h import.cpp
|
||||
interactive.cpp recur.cpp report.cpp rules.cpp rx.cpp rx.h
|
||||
text.cpp text.h utf8.cpp utf8.h util.cpp util.h Uri.cpp Uri.h)
|
||||
|
||||
add_library (task STATIC ${task_SRCS})
|
||||
add_executable (task_executable main.cpp)
|
||||
|
|
127
src/Cmd.cpp
127
src/Cmd.cpp
|
@ -127,7 +127,6 @@ void Cmd::load ()
|
|||
{
|
||||
if (commands.size () == 0)
|
||||
{
|
||||
// Commands whose names are not localized.
|
||||
commands.push_back ("_projects");
|
||||
commands.push_back ("_tags");
|
||||
commands.push_back ("_commands");
|
||||
|
@ -150,41 +149,39 @@ void Cmd::load ()
|
|||
commands.push_back ("burndown.monthly");
|
||||
commands.push_back ("count");
|
||||
commands.push_back ("ids");
|
||||
|
||||
// Commands whose names are localized.
|
||||
commands.push_back (context.stringtable.get (CMD_ADD, "add"));
|
||||
commands.push_back (context.stringtable.get (CMD_APPEND, "append"));
|
||||
commands.push_back (context.stringtable.get (CMD_ANNOTATE, "annotate"));
|
||||
commands.push_back (context.stringtable.get (CMD_DENOTATE, "denotate"));
|
||||
commands.push_back (context.stringtable.get (CMD_CALENDAR, "calendar"));
|
||||
commands.push_back (context.stringtable.get (CMD_COLORS, "colors"));
|
||||
commands.push_back (context.stringtable.get (CMD_CONFIG, "config"));
|
||||
commands.push_back (context.stringtable.get (CMD_SHOW, "show"));
|
||||
commands.push_back (context.stringtable.get (CMD_DELETE, "delete"));
|
||||
commands.push_back (context.stringtable.get (CMD_DIAGNOSTICS, "diagnostics"));
|
||||
commands.push_back (context.stringtable.get (CMD_DONE, "done"));
|
||||
commands.push_back (context.stringtable.get (CMD_DUPLICATE, "duplicate"));
|
||||
commands.push_back (context.stringtable.get (CMD_EDIT, "edit"));
|
||||
commands.push_back (context.stringtable.get (CMD_HELP, "help"));
|
||||
commands.push_back (context.stringtable.get (CMD_IMPORT, "import"));
|
||||
commands.push_back (context.stringtable.get (CMD_INFO, "info"));
|
||||
commands.push_back (context.stringtable.get (CMD_LOG, "log"));
|
||||
commands.push_back (context.stringtable.get (CMD_PREPEND, "prepend"));
|
||||
commands.push_back (context.stringtable.get (CMD_PROJECTS, "projects"));
|
||||
commands.push_back ("add");
|
||||
commands.push_back ("append");
|
||||
commands.push_back ("annotate");
|
||||
commands.push_back ("denotate");
|
||||
commands.push_back ("calendar");
|
||||
commands.push_back ("colors");
|
||||
commands.push_back ("config");
|
||||
commands.push_back ("show");
|
||||
commands.push_back ("delete");
|
||||
commands.push_back ("diagnostics");
|
||||
commands.push_back ("done");
|
||||
commands.push_back ("duplicate");
|
||||
commands.push_back ("edit");
|
||||
commands.push_back ("help");
|
||||
commands.push_back ("import");
|
||||
commands.push_back ("info");
|
||||
commands.push_back ("log");
|
||||
commands.push_back ("prepend");
|
||||
commands.push_back ("projects");
|
||||
#ifdef FEATURE_SHELL
|
||||
commands.push_back (context.stringtable.get (CMD_SHELL, "shell"));
|
||||
commands.push_back ("shell");
|
||||
#endif
|
||||
commands.push_back (context.stringtable.get (CMD_START, "start"));
|
||||
commands.push_back (context.stringtable.get (CMD_STATS, "stats"));
|
||||
commands.push_back (context.stringtable.get (CMD_STOP, "stop"));
|
||||
commands.push_back (context.stringtable.get (CMD_SUMMARY, "summary"));
|
||||
commands.push_back (context.stringtable.get (CMD_TAGS, "tags"));
|
||||
commands.push_back (context.stringtable.get (CMD_TIMESHEET, "timesheet"));
|
||||
commands.push_back (context.stringtable.get (CMD_UNDO, "undo"));
|
||||
commands.push_back (context.stringtable.get (CMD_VERSION, "version"));
|
||||
commands.push_back (context.stringtable.get (CMD_MERGE, "merge"));
|
||||
commands.push_back (context.stringtable.get (CMD_PUSH, "push"));
|
||||
commands.push_back (context.stringtable.get (CMD_PULL, "pull"));
|
||||
commands.push_back ("start");
|
||||
commands.push_back ("stats");
|
||||
commands.push_back ("stop");
|
||||
commands.push_back ("summary");
|
||||
commands.push_back ("tags");
|
||||
commands.push_back ("timesheet");
|
||||
commands.push_back ("undo");
|
||||
commands.push_back ("version");
|
||||
commands.push_back ("merge");
|
||||
commands.push_back ("push");
|
||||
commands.push_back ("pull");
|
||||
|
||||
// Now load the custom reports.
|
||||
std::vector <std::string> all;
|
||||
|
@ -260,21 +257,21 @@ bool Cmd::isReadOnlyCommand ()
|
|||
command == "burndown.monthly" ||
|
||||
command == "count" ||
|
||||
command == "ids" ||
|
||||
command == context.stringtable.get (CMD_CALENDAR, "calendar") ||
|
||||
command == context.stringtable.get (CMD_COLORS, "colors") ||
|
||||
command == context.stringtable.get (CMD_DIAGNOSTICS, "diagnostics") ||
|
||||
command == context.stringtable.get (CMD_CONFIG, "config") ||
|
||||
command == context.stringtable.get (CMD_SHOW, "show") ||
|
||||
command == context.stringtable.get (CMD_HELP, "help") ||
|
||||
command == context.stringtable.get (CMD_INFO, "info") ||
|
||||
command == context.stringtable.get (CMD_PROJECTS, "projects") ||
|
||||
command == context.stringtable.get (CMD_PUSH, "push") ||
|
||||
command == context.stringtable.get (CMD_SHELL, "shell") ||
|
||||
command == context.stringtable.get (CMD_STATS, "stats") ||
|
||||
command == context.stringtable.get (CMD_SUMMARY, "summary") ||
|
||||
command == context.stringtable.get (CMD_TAGS, "tags") ||
|
||||
command == context.stringtable.get (CMD_TIMESHEET, "timesheet") ||
|
||||
command == context.stringtable.get (CMD_VERSION, "version") ||
|
||||
command == "calendar" ||
|
||||
command == "colors" ||
|
||||
command == "diagnostics" ||
|
||||
command == "config" ||
|
||||
command == "show" ||
|
||||
command == "help" ||
|
||||
command == "info" ||
|
||||
command == "projects" ||
|
||||
command == "push" ||
|
||||
command == "shell" ||
|
||||
command == "stats" ||
|
||||
command == "summary" ||
|
||||
command == "tags" ||
|
||||
command == "timesheet" ||
|
||||
command == "version" ||
|
||||
validCustom (command))
|
||||
return true;
|
||||
|
||||
|
@ -285,22 +282,22 @@ bool Cmd::isReadOnlyCommand ()
|
|||
// Commands that directly modify the data files.
|
||||
bool Cmd::isWriteCommand ()
|
||||
{
|
||||
if (command == context.stringtable.get (CMD_MERGE, "merge") ||
|
||||
command == context.stringtable.get (CMD_ADD, "add") ||
|
||||
command == context.stringtable.get (CMD_APPEND, "append") ||
|
||||
command == context.stringtable.get (CMD_ANNOTATE, "annotate") ||
|
||||
command == context.stringtable.get (CMD_DENOTATE, "denotate") ||
|
||||
command == context.stringtable.get (CMD_DELETE, "delete") ||
|
||||
command == context.stringtable.get (CMD_DONE, "done") ||
|
||||
command == context.stringtable.get (CMD_DUPLICATE, "duplicate") ||
|
||||
command == context.stringtable.get (CMD_EDIT, "edit") ||
|
||||
command == context.stringtable.get (CMD_IMPORT, "import") ||
|
||||
command == context.stringtable.get (CMD_LOG, "log") ||
|
||||
command == context.stringtable.get (CMD_PREPEND, "prepend") ||
|
||||
command == context.stringtable.get (CMD_PULL, "pull") ||
|
||||
command == context.stringtable.get (CMD_START, "start") ||
|
||||
command == context.stringtable.get (CMD_STOP, "stop") ||
|
||||
command == context.stringtable.get (CMD_UNDO, "undo"))
|
||||
if (command == "merge" ||
|
||||
command == "add" ||
|
||||
command == "append" ||
|
||||
command == "annotate" ||
|
||||
command == "denotate" ||
|
||||
command == "delete" ||
|
||||
command == "done" ||
|
||||
command == "duplicate" ||
|
||||
command == "edit" ||
|
||||
command == "import" ||
|
||||
command == "log" ||
|
||||
command == "prepend" ||
|
||||
command == "pull" ||
|
||||
command == "start" ||
|
||||
command == "stop" ||
|
||||
command == "undo")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -51,7 +51,6 @@ Context::Context ()
|
|||
, subst ()
|
||||
, task ()
|
||||
, tdb ()
|
||||
, stringtable ()
|
||||
, program ("")
|
||||
, file_override ("")
|
||||
, var_overrides ("")
|
||||
|
@ -135,8 +134,6 @@ void Context::initialize ()
|
|||
if (config.getBoolean ("color"))
|
||||
initializeColorRules ();
|
||||
|
||||
// Load appropriate stringtable as soon after the config file as possible, to
|
||||
// allow all subsequent messages to be localizable.
|
||||
Directory location (config.get ("data.location"));
|
||||
std::string locale = config.get ("locale");
|
||||
|
||||
|
@ -145,9 +142,6 @@ void Context::initialize ()
|
|||
if (period != std::string::npos)
|
||||
locale = locale.substr (0, period);
|
||||
|
||||
if (locale != "")
|
||||
stringtable.load (location.data + "/strings." + locale);
|
||||
|
||||
// init TDB.
|
||||
tdb.clear ();
|
||||
std::vector <std::string> all;
|
||||
|
@ -175,7 +169,7 @@ int Context::run ()
|
|||
|
||||
catch (...)
|
||||
{
|
||||
footnote (stringtable.get (100, "Unknown error."));
|
||||
footnote ("Unknown error.");
|
||||
rc = 3;
|
||||
}
|
||||
|
||||
|
@ -465,10 +459,7 @@ void Context::loadCorrectConfigFile ()
|
|||
// Set up default locations.
|
||||
struct passwd* pw = getpwuid (getuid ());
|
||||
if (!pw)
|
||||
throw std::string (
|
||||
stringtable.get (
|
||||
SHELL_READ_PASSWD,
|
||||
"Could not read home directory from the passwd file."));
|
||||
throw std::string ("Could not read home directory from the passwd file.");
|
||||
|
||||
std::string home = pw->pw_dir;
|
||||
File rc (home + "/.taskrc");
|
||||
|
@ -621,8 +612,7 @@ void Context::parse (
|
|||
foundNonSequence = true;
|
||||
|
||||
if (arg->find (',') != std::string::npos)
|
||||
throw stringtable.get (TAGS_NO_COMMA,
|
||||
"Tags are not permitted to contain commas.");
|
||||
throw std::string ("Tags are not permitted to contain commas.");
|
||||
|
||||
tagAdditions.push_back (arg->substr (1));
|
||||
parseTask.addTag (arg->substr (1));
|
||||
|
@ -640,8 +630,7 @@ void Context::parse (
|
|||
foundNonSequence = true;
|
||||
|
||||
if (arg->find (',') != std::string::npos)
|
||||
throw stringtable.get (TAGS_NO_COMMA,
|
||||
"Tags are not permitted to contain commas.");
|
||||
throw std::string ("Tags are not permitted to contain commas.");
|
||||
|
||||
tagRemovals.push_back (arg->substr (1));
|
||||
}
|
||||
|
@ -801,9 +790,7 @@ void Context::parse (
|
|||
parse (args, cmd, task, sequence, subst, filter);
|
||||
}
|
||||
else
|
||||
throw stringtable.get (
|
||||
CMD_MISSING,
|
||||
"You must specify a command, or a task ID to modify.");
|
||||
throw std::string ("You must specify a command, or a task ID to modify.");
|
||||
}
|
||||
|
||||
// If the command "task 123" is entered, but with no modifier arguments,
|
||||
|
@ -831,7 +818,6 @@ void Context::clear ()
|
|||
// task.clear ();
|
||||
task = Task ();
|
||||
tdb.clear ();
|
||||
// stringtable.clear ();
|
||||
program = "";
|
||||
args.clear ();
|
||||
file_override = "";
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "Cmd.h"
|
||||
#include "Task.h"
|
||||
#include "TDB.h"
|
||||
#include "StringTable.h"
|
||||
#include "Hooks.h"
|
||||
|
||||
class Context
|
||||
|
@ -84,7 +83,6 @@ public:
|
|||
Subst subst;
|
||||
Task task;
|
||||
TDB tdb;
|
||||
StringTable stringtable;
|
||||
std::string program;
|
||||
std::vector <std::string> args;
|
||||
std::string file_override;
|
||||
|
|
|
@ -94,8 +94,7 @@ void Record::parse (const std::string& input)
|
|||
n.depleted ())
|
||||
{
|
||||
if (line.length () == 0)
|
||||
throw context.stringtable.get (RECORD_EMPTY,
|
||||
"Empty record in input.");
|
||||
throw std::string ("Empty record in input.");
|
||||
|
||||
Nibbler nl (line);
|
||||
Att a;
|
||||
|
@ -109,12 +108,10 @@ void Record::parse (const std::string& input)
|
|||
std::string remainder;
|
||||
nl.getUntilEOS (remainder);
|
||||
if (remainder.length ())
|
||||
throw context.stringtable.get (RECORD_EXTRA,
|
||||
"Unrecognized characters at end of line.");
|
||||
throw std::string ("Unrecognized characters at end of line.");
|
||||
}
|
||||
else
|
||||
throw context.stringtable.get (RECORD_NOT_FF4,
|
||||
"Record not recognized as format 4.");
|
||||
throw std::string ("Record not recognized as format 4.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -96,7 +96,7 @@ void Sequence::parse (const std::string& input)
|
|||
case 1:
|
||||
{
|
||||
if (! validId (range[0]))
|
||||
throw context.stringtable.get (SEQUENCE_BAD_SEQ, "Invalid ID in sequence.");
|
||||
throw std::string ("Invalid ID in sequence.");
|
||||
|
||||
int id = atoi (range[0].c_str ());
|
||||
this->push_back (id);
|
||||
|
@ -107,15 +107,15 @@ void Sequence::parse (const std::string& input)
|
|||
{
|
||||
if (! validId (range[0]) ||
|
||||
! validId (range[1]))
|
||||
throw context.stringtable.get (SEQUENCE_BAD_SEQ, "Invalid ID in range.");
|
||||
throw std::string ("Invalid ID in range.");
|
||||
|
||||
int low = atoi (range[0].c_str ());
|
||||
int high = atoi (range[1].c_str ());
|
||||
if (low > high)
|
||||
throw context.stringtable.get (SEQUENCE_INVERTED, "Inverted sequence range high-low.");
|
||||
throw std::string ("Inverted sequence range high-low.");
|
||||
|
||||
if (high - low >= SEQUENCE_MAX)
|
||||
throw context.stringtable.get (SEQUENCE_RANGE_MAX, "ID Range too large.");
|
||||
throw std::string ("ID Range too large.");
|
||||
|
||||
for (int i = low; i <= high; ++i)
|
||||
this->push_back (i);
|
||||
|
@ -123,7 +123,7 @@ void Sequence::parse (const std::string& input)
|
|||
break;
|
||||
|
||||
default:
|
||||
throw context.stringtable.get (SEQUENCE_NOT_A_SEQUENCE, "Not a sequence.");
|
||||
throw std::string ("Not a sequence.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,98 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <text.h>
|
||||
#include <util.h>
|
||||
#include <stdlib.h>
|
||||
#include "StringTable.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
StringTable::StringTable ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
StringTable::~StringTable ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// UTF-8 encoding
|
||||
//
|
||||
// 123 This is the string
|
||||
// 124 This is another string
|
||||
// ...
|
||||
void StringTable::load (const std::string& file)
|
||||
{
|
||||
this->clear (); // Allows dynamic reload.
|
||||
|
||||
std::ifstream in;
|
||||
in.open (file.c_str (), std::ifstream::in);
|
||||
if (in.good ())
|
||||
{
|
||||
std::string line;
|
||||
while (getline (in, line))
|
||||
{
|
||||
// Remove comments.
|
||||
std::string::size_type pound = line.find ("#"); // no i18n
|
||||
if (pound != std::string::npos)
|
||||
line = line.substr (0, pound);
|
||||
|
||||
line = trim (line, " \t"); // no i18n
|
||||
|
||||
// Skip empty lines.
|
||||
if (line.length () > 0)
|
||||
{
|
||||
std::string::size_type equal = line.find (" "); // no i18n
|
||||
if (equal != std::string::npos)
|
||||
{
|
||||
int key = atoi (trim (line.substr (0, equal), " \t").c_str ()); // no i18n
|
||||
std::string value = trim (line.substr (equal+1, line.length () - equal), " \t"); // no i18n
|
||||
(*this)[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in.close ();
|
||||
}
|
||||
else
|
||||
throw std::string ("Could not read string file '") + file + "'"; // TODO i18n
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string StringTable::get (int id, const std::string& alternate)
|
||||
{
|
||||
// Return the right string.
|
||||
if (this->find (id) != this->end ())
|
||||
return (*this)[id];
|
||||
|
||||
return alternate;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,47 +0,0 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef INCLUDED_STRINGTABLE
|
||||
#define INCLUDED_STRINGTABLE
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class StringTable : public std::map <int, std::string>
|
||||
{
|
||||
public:
|
||||
StringTable (); // Default constructor
|
||||
~StringTable (); // Destructor
|
||||
|
||||
StringTable (const StringTable&);
|
||||
StringTable& operator= (const StringTable&);
|
||||
|
||||
void load (const std::string&);
|
||||
std::string get (int, const std::string&);
|
||||
};
|
||||
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -111,16 +111,13 @@ void Subst::parse (const std::string& input)
|
|||
mGlobal = n.skip ('g');
|
||||
|
||||
if (mFrom == "")
|
||||
throw context.stringtable.get (SUBST_EMPTY,
|
||||
"Cannot substitute an empty string.");
|
||||
throw std::string ("Cannot substitute an empty string.");
|
||||
|
||||
if (!n.depleted ())
|
||||
throw context.stringtable.get (SUBST_BAD_CHARS,
|
||||
"Unrecognized character(s) at end of substitution.");
|
||||
throw std::string ("Unrecognized character(s) at end of substitution.");
|
||||
}
|
||||
else
|
||||
throw context.stringtable.get (SUBST_MALFORMED,
|
||||
"Malformed substitution.");
|
||||
throw std::string ("Malformed substitution.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -2497,7 +2497,7 @@ void handleShell ()
|
|||
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << context.stringtable.get (100, "Unknown error.") << "\n";
|
||||
std::cerr << "Unknown error." << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ int main (int argc, char** argv)
|
|||
|
||||
catch (...)
|
||||
{
|
||||
std::cerr << context.stringtable.get (100, "Unknown error.") << "\n";
|
||||
std::cerr << "Unknown error." << "\n";
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,9 +77,8 @@ int Context::handleInteractive ()
|
|||
|
||||
#else
|
||||
|
||||
throw stringtable.get (INTERACTIVE_NO_NCURSES,
|
||||
"Interactive task is only available when built with ncurses "
|
||||
"support.");
|
||||
throw std::string ("Interactive task is only available when built with "
|
||||
"ncurses support.");
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -59,9 +59,7 @@ bool confirm (const std::string& question)
|
|||
do
|
||||
{
|
||||
std::cout << question
|
||||
<< " "
|
||||
<< context.stringtable.get (CONFIRM_YES_NO, "(y/n)")
|
||||
<< " ";
|
||||
<< " (y/n) ";
|
||||
|
||||
std::getline (std::cin, answer);
|
||||
answer = std::cin.eof() ? "no" : lowerCase (trim (answer));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue