mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-19 09:53:08 +02:00
Enhancements - i18n & Subst
- Created initial, empty strings files. - Converted Subst to use Nibbler.
This commit is contained in:
parent
7248267a72
commit
75c220c352
6 changed files with 70 additions and 29 deletions
11
i18n/strings.de-DE
Normal file
11
i18n/strings.de-DE
Normal file
|
@ -0,0 +1,11 @@
|
|||
# 1xx task shell
|
||||
100 Unbekannter Fehler.
|
||||
|
||||
# 2xx Commands
|
||||
# 3xx Attributes
|
||||
# 4xx Columns
|
||||
# 5xx Colors
|
||||
# 6xx Config
|
||||
# 7xx TDB
|
||||
# 8xx Reports
|
||||
|
11
i18n/strings.es-ES
Normal file
11
i18n/strings.es-ES
Normal file
|
@ -0,0 +1,11 @@
|
|||
# 1xx task shell
|
||||
100 Error desconocido.
|
||||
|
||||
# 2xx Commands
|
||||
# 3xx Attributes
|
||||
# 4xx Columns
|
||||
# 5xx Colors
|
||||
# 6xx Config
|
||||
# 7xx TDB
|
||||
# 8xx Reports
|
||||
|
11
i18n/strings.fr-FR
Normal file
11
i18n/strings.fr-FR
Normal file
|
@ -0,0 +1,11 @@
|
|||
# 1xx task shell
|
||||
100 Erreur inconnue.
|
||||
|
||||
# 2xx Commands
|
||||
# 3xx Attributes
|
||||
# 4xx Columns
|
||||
# 5xx Colors
|
||||
# 6xx Config
|
||||
# 7xx TDB
|
||||
# 8xx Reports
|
||||
|
11
i18n/strings.nl-NL
Normal file
11
i18n/strings.nl-NL
Normal file
|
@ -0,0 +1,11 @@
|
|||
# 1xx task shell
|
||||
100 Onbekende fout.
|
||||
|
||||
# 2xx Commands
|
||||
# 3xx Attributes
|
||||
# 4xx Columns
|
||||
# 5xx Colors
|
||||
# 6xx Config
|
||||
# 7xx TDB
|
||||
# 8xx Reports
|
||||
|
|
@ -25,7 +25,8 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <Subst.h>
|
||||
#include "Subst.h"
|
||||
#include "Nibbler.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Subst::Subst ()
|
||||
|
@ -70,36 +71,18 @@ Subst::~Subst ()
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Subst::parse (const std::string& input)
|
||||
{
|
||||
size_t first = input.find ('/');
|
||||
if (first != std::string::npos)
|
||||
Nibbler n (input);
|
||||
if (n.skip ('/') &&
|
||||
n.getUntil ('/', mFrom) &&
|
||||
n.skip ('/') &&
|
||||
n.getUntil ('/', mTo) &&
|
||||
n.skip ('/'))
|
||||
{
|
||||
size_t second = input.find ('/', first + 1);
|
||||
if (second != std::string::npos)
|
||||
{
|
||||
size_t third = input.find ('/', second + 1);
|
||||
if (third != std::string::npos)
|
||||
{
|
||||
if (first == 0 &&
|
||||
first < second &&
|
||||
second < third &&
|
||||
(third == input.length () - 1 ||
|
||||
third == input.length () - 2))
|
||||
{
|
||||
mFrom = input.substr (first + 1, second - first - 1);
|
||||
mTo = input.substr (second + 1, third - second - 1);
|
||||
|
||||
mGlobal = false;
|
||||
if (third == input.length () - 2 &&
|
||||
input.find ('g', third + 1) != std::string::npos)
|
||||
mGlobal = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
mGlobal = n.skip ('g');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (2);
|
||||
UnitTest t (3);
|
||||
|
||||
T2 task;
|
||||
task.set ("description", "one two three four");
|
||||
|
@ -65,6 +65,20 @@ int main (int argc, char** argv)
|
|||
t.fail ("failed to parse '/e /E /g'");
|
||||
}
|
||||
|
||||
if (s.parse ("/from/to/g"))
|
||||
{
|
||||
std::string description = task.get ("description");
|
||||
std::vector <Att> annotations;
|
||||
task.getAnnotations (annotations);
|
||||
|
||||
s.apply (description, annotations);
|
||||
t.is (description, "one two three four", "multiple word subst mismatch");
|
||||
}
|
||||
else
|
||||
{
|
||||
t.fail ("failed to parse '/from/to/g'");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue