mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +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
|
@ -1,4 +1,3 @@
|
||||||
install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${TASK_DOCDIR}/i18n
|
install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION ${TASK_DOCDIR}/i18n
|
||||||
FILES_MATCHING REGEX "strings.*"
|
FILES_MATCHING REGEX "tips.*"
|
||||||
REGEX "tips.*"
|
|
||||||
PATTERN "CMakeFiles" EXCLUDE)
|
PATTERN "CMakeFiles" EXCLUDE)
|
||||||
|
|
|
@ -1,157 +0,0 @@
|
||||||
# This is an example strings.en-US file.
|
|
||||||
#
|
|
||||||
# The task program has a built-in set of default strings, which are UTF8 encoded
|
|
||||||
# for the en-US locale. A file such as this is used to override those defaults.
|
|
||||||
# This means that a strings file is merely a delta applied to the built-in
|
|
||||||
# strings, so an empty string file means you get en-US.
|
|
||||||
#
|
|
||||||
# To use another string file, add the following entry to your .taskrc file:
|
|
||||||
#
|
|
||||||
# locale=sv-SE # Swedish string set
|
|
||||||
|
|
||||||
# 1xx task shell
|
|
||||||
100 Unbekannter Fehler #Unknown Error.
|
|
||||||
101 Konnte nicht Datenverzeichnis HOME aus passwd Datei lesen #Could not read home directory from the passwd file.
|
|
||||||
102 (j/n) #(y/n)
|
|
||||||
103 Ungültige ID in Sequenz #Invalid ID in sequence
|
|
||||||
104 Ungültige ID in Bereich #Invalid ID in range
|
|
||||||
105 Invertierter Sequenzbereich hoch-niedrig #Inverted sequence range high-low
|
|
||||||
106 ID Bereich zu gross #ID Range too large
|
|
||||||
107 Keine Sequenz #Not a sequence.
|
|
||||||
108 Task interaktiv nur möglich mit vorhandenem ncurses #Interactive task is only available when built with ncurses support.
|
|
||||||
109 Leerer Eintrag in der Eingabe #Empty record in input
|
|
||||||
110 Unbekanntes Zeichen am Zeilenende #Unrecognized characters at end of line
|
|
||||||
111 Datensatz nicht als Format 4 erkannt #Record not recognized as format 4
|
|
||||||
112 Kann leere Zeichenkette nicht ersetzen #Cannot substitute an empty string
|
|
||||||
113 Nicht erkanntes Zeichen am Ende der Ersetzung #Unrecognized character(s) at end of substitution
|
|
||||||
114 Fehlformulierte Ersetzung #Malformed substitution
|
|
||||||
115 Etiketten dürfen keine Kommas enthalten #Tags are not permitted to contain commas
|
|
||||||
|
|
||||||
# 2xx Commands - must be sequential
|
|
||||||
200 aktiv #active
|
|
||||||
201 hinzufen #add
|
|
||||||
202 beizufügen #append
|
|
||||||
203 anmerkung #annotate
|
|
||||||
204 kalender #calendar
|
|
||||||
205 farben #colors
|
|
||||||
206 fertiggestellt #completed
|
|
||||||
207 löschen #delete
|
|
||||||
208 erledigt #done
|
|
||||||
209 duplizieren #duplicate
|
|
||||||
210 editieren #edit
|
|
||||||
211 export #export
|
|
||||||
212 hilfe #help
|
|
||||||
213 geschichte #history
|
|
||||||
214 ggeschichte #ghistory
|
|
||||||
215 import #import
|
|
||||||
216 info #info
|
|
||||||
|
|
||||||
218 überfällig #overdue
|
|
||||||
219 projekte #projects
|
|
||||||
220 start #start
|
|
||||||
221 statistik #stats
|
|
||||||
222 stop #stop
|
|
||||||
223 zusammenfassung #summary
|
|
||||||
224 etikett #tags
|
|
||||||
225 zeitdatenblatt#timesheet
|
|
||||||
|
|
||||||
227 rücksetzen #undo
|
|
||||||
228 version #version
|
|
||||||
|
|
||||||
# 3xx Attributes - must be sequential
|
|
||||||
300 projekt #project
|
|
||||||
301 priorität #priority
|
|
||||||
302 vordergrund #fg
|
|
||||||
303 hintergrund #bg
|
|
||||||
304 fällig #due
|
|
||||||
305 eintrag #entry
|
|
||||||
306 start #start
|
|
||||||
307 stop #end
|
|
||||||
308 wiederkehrend #recur
|
|
||||||
309 bis #until
|
|
||||||
310 mask #mask
|
|
||||||
311 imask #imask
|
|
||||||
|
|
||||||
# 35x Attribute modifiers - must be sequential
|
|
||||||
350 davor #before
|
|
||||||
351 danach #after
|
|
||||||
352 nict #not
|
|
||||||
353 kein #none
|
|
||||||
354 beliebig #any
|
|
||||||
355 synth #synth
|
|
||||||
356 unter #under
|
|
||||||
357 über #over
|
|
||||||
358 erstes #first
|
|
||||||
359 letztes #last
|
|
||||||
360 dieses #this
|
|
||||||
361 nächste #next
|
|
||||||
362 ist #is
|
|
||||||
363 istnicht #isnt
|
|
||||||
364 hat #has
|
|
||||||
365 hatnicht #hasnt
|
|
||||||
366 beginntmit #startswith
|
|
||||||
367 endetmit #endswith
|
|
||||||
|
|
||||||
# 4xx Columns
|
|
||||||
|
|
||||||
# 5xx Colors
|
|
||||||
500 fett #bold
|
|
||||||
501 unterstrichen #underline
|
|
||||||
502 fett_unterstrichen #bold_underline
|
|
||||||
503 schwarz #black
|
|
||||||
504 rot #red
|
|
||||||
505 grün #green
|
|
||||||
506 gelb #yellow
|
|
||||||
507 blau #blue
|
|
||||||
508 magenta #magenta
|
|
||||||
509 cyan #cyan
|
|
||||||
510 weiss #white
|
|
||||||
511 fett_schwarz #bold_black
|
|
||||||
512 fett_rot #bold_red
|
|
||||||
513 fett_grün #bold_green
|
|
||||||
514 fett_gelb #bold_yellow
|
|
||||||
515 fett_blau #bold_blue
|
|
||||||
516 fett_magenta #bold_magenta
|
|
||||||
517 fett_cyan #bold_cyan
|
|
||||||
518 fett_weiss #bold_white
|
|
||||||
519 unterstrichen_schwarz #underline_black
|
|
||||||
520 unterstrichen_rot #underline_red
|
|
||||||
521 unterstrichen_grün #underline_green
|
|
||||||
522 unterstrichen_gelb #underline_yellow
|
|
||||||
523 unterstrichen_blau #underline_blue
|
|
||||||
524 unterstrichen_magenta #underline_magenta
|
|
||||||
525 unterstrichen_cyan #underline_cyan
|
|
||||||
526 unterstrichen_weiss #underline_white
|
|
||||||
527 fett_unterstrichen_schwarz #bold_underline_black
|
|
||||||
528 fett_unterstrichen_rot #bold_underline_red
|
|
||||||
529 fett_unterstrichen_grün #bold_underline_green
|
|
||||||
530 fett_unterstrichen_gelb #bold_underline_yellow
|
|
||||||
531 fett_unterstrichen_blau #bold_underline_blue
|
|
||||||
532 fett_unterstrichen_magenta #bold_underline_magenta
|
|
||||||
533 fett_unterstrichen_cyan #bold_underline_cyan
|
|
||||||
534 fett_unterstrichen_weiss #bold_underline_white
|
|
||||||
535 auf_schwarz #on_black
|
|
||||||
536 auf_rot #on_red
|
|
||||||
537 auf_grün #on_green
|
|
||||||
538 auf_gelb #on_yellow
|
|
||||||
539 auf_blau #on_blue
|
|
||||||
540 auf_magenta #on_magenta
|
|
||||||
541 auf_cyan #on_cyan
|
|
||||||
542 auf_weiss #on_white
|
|
||||||
543 auf_signal_schwarz #on_bright_black
|
|
||||||
544 auf_signal_rot #on_bright_red
|
|
||||||
545 auf_signal_grün #on_bright_green
|
|
||||||
546 auf_signal_gelb #on_bright_yellow
|
|
||||||
547 auf_signal_blau #on_bright_blue
|
|
||||||
548 auf_signal_magenta #on_bright_magenta
|
|
||||||
549 auf_signal_cyan #on_bright_cyan
|
|
||||||
550 auf_signal_weiss #on_bright_white
|
|
||||||
551 aus #off
|
|
||||||
552 Unbekannte Farbe #Unknown color name
|
|
||||||
|
|
||||||
# 6xx Config
|
|
||||||
|
|
||||||
# 7xx TDB
|
|
||||||
|
|
||||||
# 8xx Reports
|
|
||||||
|
|
|
@ -1,125 +0,0 @@
|
||||||
# This is an example strings.en-US file.
|
|
||||||
#
|
|
||||||
# The taskwarrior program has a built-in set of default strings, which are UTF8
|
|
||||||
# encoded for the en-US locale. A file such as this is used to override those
|
|
||||||
# defaults. This means that a strings file is merely a delta applied to the
|
|
||||||
# built-in strings, so an empty string file means you get en-US.
|
|
||||||
#
|
|
||||||
# To use another string file, add the following entry to your .taskrc file:
|
|
||||||
#
|
|
||||||
# locale=sv-SE # Swedish string set
|
|
||||||
|
|
||||||
# 1xx task shell
|
|
||||||
100 Unknown Error.
|
|
||||||
101 Could not read home directory from the passwd file.
|
|
||||||
102 (y/n)
|
|
||||||
103 Invalid ID in sequence
|
|
||||||
104 Invalid ID in range
|
|
||||||
105 Inverted sequence range high-low
|
|
||||||
106 ID Range too large
|
|
||||||
107 Not a sequence.
|
|
||||||
|
|
||||||
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
|
|
||||||
115 Tags are not permitted to contain commas
|
|
||||||
116 You must specify a command, or a task ID to modify
|
|
||||||
|
|
||||||
# 2xx Commands - must be sequential
|
|
||||||
200 active
|
|
||||||
201 add
|
|
||||||
202 append
|
|
||||||
203 annotate
|
|
||||||
204 calendar
|
|
||||||
205 colors
|
|
||||||
206 completed
|
|
||||||
207 delete
|
|
||||||
208 done
|
|
||||||
209 duplicate
|
|
||||||
210 edit
|
|
||||||
|
|
||||||
212 help
|
|
||||||
|
|
||||||
215 import
|
|
||||||
216 info
|
|
||||||
217 prepend
|
|
||||||
218 overdue
|
|
||||||
219 projects
|
|
||||||
220 start
|
|
||||||
221 stats
|
|
||||||
222 stop
|
|
||||||
223 summary
|
|
||||||
224 tags
|
|
||||||
225 timesheet
|
|
||||||
226 log
|
|
||||||
227 undo
|
|
||||||
228 version
|
|
||||||
229 shell
|
|
||||||
230 config
|
|
||||||
231 show
|
|
||||||
|
|
||||||
235 diagnostics
|
|
||||||
|
|
||||||
# 3xx Attributes - must be sequential
|
|
||||||
300 project
|
|
||||||
301 priority
|
|
||||||
302 fg
|
|
||||||
303 bg
|
|
||||||
304 due
|
|
||||||
305 entry
|
|
||||||
306 start
|
|
||||||
307 end
|
|
||||||
308 recur
|
|
||||||
309 until
|
|
||||||
310 mask
|
|
||||||
311 imask
|
|
||||||
|
|
||||||
# 35x Attribute modifiers - must be sequential
|
|
||||||
350 before
|
|
||||||
351 after
|
|
||||||
352 not
|
|
||||||
353 none
|
|
||||||
354 any
|
|
||||||
355 synth
|
|
||||||
356 under
|
|
||||||
357 over
|
|
||||||
358 first
|
|
||||||
359 last
|
|
||||||
360 this
|
|
||||||
361 next
|
|
||||||
362 is
|
|
||||||
363 isnt
|
|
||||||
364 has
|
|
||||||
365 hasnt
|
|
||||||
366 startswith
|
|
||||||
367 endswith
|
|
||||||
|
|
||||||
# 4xx Columns
|
|
||||||
|
|
||||||
# 5xx Colors
|
|
||||||
500 bold
|
|
||||||
501 underline
|
|
||||||
502 on
|
|
||||||
503 bright
|
|
||||||
|
|
||||||
504 black
|
|
||||||
505 red
|
|
||||||
506 green
|
|
||||||
507 yellow
|
|
||||||
508 blue
|
|
||||||
509 magenta
|
|
||||||
510 cyan
|
|
||||||
511 white
|
|
||||||
|
|
||||||
520 off
|
|
||||||
521 Unknown color name
|
|
||||||
|
|
||||||
# 6xx Config
|
|
||||||
|
|
||||||
# 7xx TDB
|
|
||||||
|
|
||||||
# 8xx Reports
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# 1xx task shell
|
|
||||||
100 Error desconocido.
|
|
||||||
|
|
||||||
# 2xx Commands
|
|
||||||
# 3xx Attributes
|
|
||||||
# 4xx Columns
|
|
||||||
# 5xx Colors
|
|
||||||
# 6xx Config
|
|
||||||
# 7xx TDB
|
|
||||||
# 8xx Reports
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# 1xx task shell
|
|
||||||
100 Erreur inconnue.
|
|
||||||
|
|
||||||
# 2xx Commands
|
|
||||||
# 3xx Attributes
|
|
||||||
# 4xx Columns
|
|
||||||
# 5xx Colors
|
|
||||||
# 6xx Config
|
|
||||||
# 7xx TDB
|
|
||||||
# 8xx Reports
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
# 1xx task shell
|
|
||||||
100 Onbekende fout.
|
|
||||||
|
|
||||||
# 2xx Commands
|
|
||||||
# 3xx Attributes
|
|
||||||
# 4xx Columns
|
|
||||||
# 5xx Colors
|
|
||||||
# 6xx Config
|
|
||||||
# 7xx TDB
|
|
||||||
# 8xx Reports
|
|
||||||
|
|
|
@ -1,157 +0,0 @@
|
||||||
# This is an example strings.en-US file.
|
|
||||||
#
|
|
||||||
# The taskwarrior program has a built-in set of default strings, which are UTF8
|
|
||||||
# encoded for the en-US locale. A file such as this is used to override those
|
|
||||||
# default. This means that a strings file is merely a delta applied to the
|
|
||||||
# built-in strings, so an empty string file means you get en-US.
|
|
||||||
#
|
|
||||||
# To use another string file, add the following entry to your .taskrc file:
|
|
||||||
#
|
|
||||||
# locale=sv-SE # Swedish string set
|
|
||||||
|
|
||||||
# 1xx task shell
|
|
||||||
100 Okänt fel. #Unknown Error.
|
|
||||||
101 Kunde inte läsa hemkatalogen från passwd filen. #Could not read home directory from the passwd file.
|
|
||||||
102 (j/n) #(y/n)
|
|
||||||
103 Ogiltig ID i sekvens #Invalid ID in sequence
|
|
||||||
104 Ogiltig ID i spännvidd #Invalid ID in range
|
|
||||||
105 Inverterad sekvens spännvidd hög-låg #Inverted sequence range high-low
|
|
||||||
106 ID spännvidd för stor #ID Range too large
|
|
||||||
107 Ingen sekvens. #Not a sequence.
|
|
||||||
108 Interaktiv task är bara tillgänglig när den kompilerades med support för ncurses. #Interactive task is only available when built with ncurses support.
|
|
||||||
109 Tom post i ingångsdata #Empty record in input
|
|
||||||
110 Okänt tecknen på slutet av raden. #Unrecognized characters at end of line
|
|
||||||
111 Post inte indentifierad som format 4 #Record not recognized as format 4
|
|
||||||
112 Substitution av tom teckensträng är inte möjligt #Cannot substitute an empty string
|
|
||||||
113 Pkänt tecken vid slutet av substitution #Unrecognized character(s) at end of substitution
|
|
||||||
114 Ogiltig substitution #Malformed substitution
|
|
||||||
115 Taggar får inte innehåller komman #Tags are not permitted to contain commas
|
|
||||||
|
|
||||||
# 2xx Commands - must be sequential
|
|
||||||
200 aktivt #active
|
|
||||||
201 tillägg #add
|
|
||||||
202 bifoga #append
|
|
||||||
203 kommentera #annotate
|
|
||||||
204 kalender #calendar
|
|
||||||
205 färger #colors
|
|
||||||
206 avslutad #completed
|
|
||||||
207 stryk #delete
|
|
||||||
208 färdig #done
|
|
||||||
209 kopiera #duplicate
|
|
||||||
210 redigera #edit
|
|
||||||
211 exportera #export
|
|
||||||
212 hjälp #help
|
|
||||||
213 historia #history
|
|
||||||
214 ghistoria #ghistory
|
|
||||||
215 importera #import
|
|
||||||
216 info #info
|
|
||||||
|
|
||||||
218 försenad #overdue
|
|
||||||
219 projekten #projects
|
|
||||||
220 start #start
|
|
||||||
221 statistik #stats
|
|
||||||
222 stop #stop
|
|
||||||
223 sammanfattning #summary
|
|
||||||
224 taggar #tags
|
|
||||||
225 tidsrapport #timesheet
|
|
||||||
|
|
||||||
227 ångra #undo
|
|
||||||
228 version #version
|
|
||||||
|
|
||||||
# 3xx Attributes - must be sequential
|
|
||||||
300 projekt #project
|
|
||||||
301 prioritet #priority
|
|
||||||
302 förgrund #fg
|
|
||||||
303 bakgrund #bg
|
|
||||||
304 väntad #due
|
|
||||||
305 post #entry
|
|
||||||
306 start #start
|
|
||||||
307 slut #end
|
|
||||||
308 periodirskt #recur
|
|
||||||
309 innan #until
|
|
||||||
310 mask #mask
|
|
||||||
311 imask #imask
|
|
||||||
|
|
||||||
# 35x Attribute modifiers - must be sequential
|
|
||||||
350 före #before
|
|
||||||
351 efter #after
|
|
||||||
352 inte #not
|
|
||||||
353 ingen #none
|
|
||||||
354 några #any
|
|
||||||
355 synth #synth
|
|
||||||
356 under #under
|
|
||||||
357 över #over
|
|
||||||
358 första #first
|
|
||||||
359 sista #last
|
|
||||||
360 detta #this
|
|
||||||
361 nästa #next
|
|
||||||
362 är #is
|
|
||||||
363 ärinte #isnt
|
|
||||||
364 har #has
|
|
||||||
365 harinte #hasnt
|
|
||||||
366 börjarmed #startswith
|
|
||||||
367 slutarmed #endswith
|
|
||||||
|
|
||||||
# 4xx Columns
|
|
||||||
|
|
||||||
# 5xx Colors
|
|
||||||
500 fet #bold
|
|
||||||
501 understrykt #underline
|
|
||||||
502 fet_understrykt #bold_underline
|
|
||||||
503 svart #black
|
|
||||||
504 röd #red
|
|
||||||
505 grön #green
|
|
||||||
506 gul #yellow
|
|
||||||
507 blå #blue
|
|
||||||
508 magenta #magenta
|
|
||||||
509 cyan #cyan
|
|
||||||
510 vit #white
|
|
||||||
511 fet_svart #bold_black
|
|
||||||
512 fet_röd #bold_red
|
|
||||||
513 fet_grön #bold_green
|
|
||||||
514 fet_gul #bold_yellow
|
|
||||||
515 fet_blå #bold_blue
|
|
||||||
516 fet_magenta #bold_magenta
|
|
||||||
517 fet_cyan #bold_cyan
|
|
||||||
518 fet_vit #bold_white
|
|
||||||
519 understrykt_svart #underline_black
|
|
||||||
520 understrykt_röd #underline_red
|
|
||||||
521 understrykt_grön #underline_green
|
|
||||||
522 understrykt_gul #underline_yellow
|
|
||||||
523 understrykt_blå #underline_blue
|
|
||||||
524 understrykt_magenta #underline_magenta
|
|
||||||
525 understrykt_cyan #underline_cyan
|
|
||||||
526 understrykt_vit #underline_white
|
|
||||||
527 fet_understrykt_svart #bold_underline_black
|
|
||||||
528 fet_understrykt_röd #bold_underline_red
|
|
||||||
529 fet_understrykt_grön #bold_underline_green
|
|
||||||
530 fet_understrykt_gul #bold_underline_yellow
|
|
||||||
531 fet_understrykt_blå #bold_underline_blue
|
|
||||||
532 fet_understrykt_magenta #bold_underline_magenta
|
|
||||||
533 fet_understrykt_cyan #bold_underline_cyan
|
|
||||||
534 fet_understrykt_vit #bold_underline_white
|
|
||||||
535 på_svart #on_black
|
|
||||||
536 på_röd #on_red
|
|
||||||
537 på_grön #on_green
|
|
||||||
538 på_gul #on_yellow
|
|
||||||
539 på_blå #on_blue
|
|
||||||
540 på_magenta #on_magenta
|
|
||||||
541 på_cyan #on_cyan
|
|
||||||
542 på_vit #on_white
|
|
||||||
543 på_ljust_svart #on_bright_black
|
|
||||||
544 på_ljust_röd #on_bright_red
|
|
||||||
545 på_ljust_grön #on_bright_green
|
|
||||||
546 på_ljust_gul #on_bright_yellow
|
|
||||||
547 på_ljust_blå #on_bright_blue
|
|
||||||
548 på_ljust_magenta #on_bright_magenta
|
|
||||||
549 på_ljust_cyan #on_bright_cyan
|
|
||||||
550 på_ljust_vit #on_bright_white
|
|
||||||
551 av #off
|
|
||||||
552 Okänt färg namn #Unknown color name
|
|
||||||
|
|
||||||
# 6xx Config
|
|
||||||
|
|
||||||
# 7xx TDB
|
|
||||||
|
|
||||||
# 8xx Reports
|
|
||||||
|
|
|
@ -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
|
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
|
Location.h Nibbler.cpp Nibbler.h Path.cpp Path.h Permission.cpp
|
||||||
Permission.h Record.cpp Record.h Rectangle.cpp Rectangle.h
|
Permission.h Record.cpp Record.h Rectangle.cpp Rectangle.h
|
||||||
Sensor.cpp Sensor.h Sequence.cpp Sequence.h StringTable.cpp
|
Sensor.cpp Sensor.h Sequence.cpp Sequence.h Subst.cpp Subst.h
|
||||||
StringTable.h Subst.cpp Subst.h TDB.cpp TDB.h Table.cpp Table.h
|
TDB.cpp TDB.h Table.cpp Table.h Task.cpp Task.h Taskmod.cpp
|
||||||
Task.cpp Task.h Taskmod.cpp Taskmod.h Thread.cpp Thread.h
|
Taskmod.h Thread.cpp Thread.h Timer.cpp Timer.h Transport.cpp
|
||||||
Timer.cpp Timer.h Transport.cpp Transport.h TransportSSH.cpp
|
Transport.h TransportSSH.cpp TransportSSH.h TransportRSYNC.cpp
|
||||||
TransportSSH.h TransportRSYNC.cpp TransportRSYNC.h
|
TransportRSYNC.h TransportCurl.cpp TransportCurl.h Tree.cpp
|
||||||
TransportCurl.cpp TransportCurl.h Tree.cpp Tree.h burndown.cpp
|
Tree.h burndown.cpp command.cpp custom.cpp dependency.cpp
|
||||||
command.cpp custom.cpp dependency.cpp diag.cpp edit.cpp
|
diag.cpp edit.cpp export.cpp history.cpp i18n.h import.cpp
|
||||||
export.cpp history.cpp i18n.h import.cpp interactive.cpp
|
interactive.cpp recur.cpp report.cpp rules.cpp rx.cpp rx.h
|
||||||
recur.cpp report.cpp rules.cpp rx.cpp rx.h text.cpp text.h
|
text.cpp text.h utf8.cpp utf8.h util.cpp util.h Uri.cpp Uri.h)
|
||||||
utf8.cpp utf8.h util.cpp util.h Uri.cpp Uri.h)
|
|
||||||
|
|
||||||
add_library (task STATIC ${task_SRCS})
|
add_library (task STATIC ${task_SRCS})
|
||||||
add_executable (task_executable main.cpp)
|
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)
|
if (commands.size () == 0)
|
||||||
{
|
{
|
||||||
// Commands whose names are not localized.
|
|
||||||
commands.push_back ("_projects");
|
commands.push_back ("_projects");
|
||||||
commands.push_back ("_tags");
|
commands.push_back ("_tags");
|
||||||
commands.push_back ("_commands");
|
commands.push_back ("_commands");
|
||||||
|
@ -150,41 +149,39 @@ void Cmd::load ()
|
||||||
commands.push_back ("burndown.monthly");
|
commands.push_back ("burndown.monthly");
|
||||||
commands.push_back ("count");
|
commands.push_back ("count");
|
||||||
commands.push_back ("ids");
|
commands.push_back ("ids");
|
||||||
|
commands.push_back ("add");
|
||||||
// Commands whose names are localized.
|
commands.push_back ("append");
|
||||||
commands.push_back (context.stringtable.get (CMD_ADD, "add"));
|
commands.push_back ("annotate");
|
||||||
commands.push_back (context.stringtable.get (CMD_APPEND, "append"));
|
commands.push_back ("denotate");
|
||||||
commands.push_back (context.stringtable.get (CMD_ANNOTATE, "annotate"));
|
commands.push_back ("calendar");
|
||||||
commands.push_back (context.stringtable.get (CMD_DENOTATE, "denotate"));
|
commands.push_back ("colors");
|
||||||
commands.push_back (context.stringtable.get (CMD_CALENDAR, "calendar"));
|
commands.push_back ("config");
|
||||||
commands.push_back (context.stringtable.get (CMD_COLORS, "colors"));
|
commands.push_back ("show");
|
||||||
commands.push_back (context.stringtable.get (CMD_CONFIG, "config"));
|
commands.push_back ("delete");
|
||||||
commands.push_back (context.stringtable.get (CMD_SHOW, "show"));
|
commands.push_back ("diagnostics");
|
||||||
commands.push_back (context.stringtable.get (CMD_DELETE, "delete"));
|
commands.push_back ("done");
|
||||||
commands.push_back (context.stringtable.get (CMD_DIAGNOSTICS, "diagnostics"));
|
commands.push_back ("duplicate");
|
||||||
commands.push_back (context.stringtable.get (CMD_DONE, "done"));
|
commands.push_back ("edit");
|
||||||
commands.push_back (context.stringtable.get (CMD_DUPLICATE, "duplicate"));
|
commands.push_back ("help");
|
||||||
commands.push_back (context.stringtable.get (CMD_EDIT, "edit"));
|
commands.push_back ("import");
|
||||||
commands.push_back (context.stringtable.get (CMD_HELP, "help"));
|
commands.push_back ("info");
|
||||||
commands.push_back (context.stringtable.get (CMD_IMPORT, "import"));
|
commands.push_back ("log");
|
||||||
commands.push_back (context.stringtable.get (CMD_INFO, "info"));
|
commands.push_back ("prepend");
|
||||||
commands.push_back (context.stringtable.get (CMD_LOG, "log"));
|
commands.push_back ("projects");
|
||||||
commands.push_back (context.stringtable.get (CMD_PREPEND, "prepend"));
|
|
||||||
commands.push_back (context.stringtable.get (CMD_PROJECTS, "projects"));
|
|
||||||
#ifdef FEATURE_SHELL
|
#ifdef FEATURE_SHELL
|
||||||
commands.push_back (context.stringtable.get (CMD_SHELL, "shell"));
|
commands.push_back ("shell");
|
||||||
#endif
|
#endif
|
||||||
commands.push_back (context.stringtable.get (CMD_START, "start"));
|
commands.push_back ("start");
|
||||||
commands.push_back (context.stringtable.get (CMD_STATS, "stats"));
|
commands.push_back ("stats");
|
||||||
commands.push_back (context.stringtable.get (CMD_STOP, "stop"));
|
commands.push_back ("stop");
|
||||||
commands.push_back (context.stringtable.get (CMD_SUMMARY, "summary"));
|
commands.push_back ("summary");
|
||||||
commands.push_back (context.stringtable.get (CMD_TAGS, "tags"));
|
commands.push_back ("tags");
|
||||||
commands.push_back (context.stringtable.get (CMD_TIMESHEET, "timesheet"));
|
commands.push_back ("timesheet");
|
||||||
commands.push_back (context.stringtable.get (CMD_UNDO, "undo"));
|
commands.push_back ("undo");
|
||||||
commands.push_back (context.stringtable.get (CMD_VERSION, "version"));
|
commands.push_back ("version");
|
||||||
commands.push_back (context.stringtable.get (CMD_MERGE, "merge"));
|
commands.push_back ("merge");
|
||||||
commands.push_back (context.stringtable.get (CMD_PUSH, "push"));
|
commands.push_back ("push");
|
||||||
commands.push_back (context.stringtable.get (CMD_PULL, "pull"));
|
commands.push_back ("pull");
|
||||||
|
|
||||||
// Now load the custom reports.
|
// Now load the custom reports.
|
||||||
std::vector <std::string> all;
|
std::vector <std::string> all;
|
||||||
|
@ -260,21 +257,21 @@ bool Cmd::isReadOnlyCommand ()
|
||||||
command == "burndown.monthly" ||
|
command == "burndown.monthly" ||
|
||||||
command == "count" ||
|
command == "count" ||
|
||||||
command == "ids" ||
|
command == "ids" ||
|
||||||
command == context.stringtable.get (CMD_CALENDAR, "calendar") ||
|
command == "calendar" ||
|
||||||
command == context.stringtable.get (CMD_COLORS, "colors") ||
|
command == "colors" ||
|
||||||
command == context.stringtable.get (CMD_DIAGNOSTICS, "diagnostics") ||
|
command == "diagnostics" ||
|
||||||
command == context.stringtable.get (CMD_CONFIG, "config") ||
|
command == "config" ||
|
||||||
command == context.stringtable.get (CMD_SHOW, "show") ||
|
command == "show" ||
|
||||||
command == context.stringtable.get (CMD_HELP, "help") ||
|
command == "help" ||
|
||||||
command == context.stringtable.get (CMD_INFO, "info") ||
|
command == "info" ||
|
||||||
command == context.stringtable.get (CMD_PROJECTS, "projects") ||
|
command == "projects" ||
|
||||||
command == context.stringtable.get (CMD_PUSH, "push") ||
|
command == "push" ||
|
||||||
command == context.stringtable.get (CMD_SHELL, "shell") ||
|
command == "shell" ||
|
||||||
command == context.stringtable.get (CMD_STATS, "stats") ||
|
command == "stats" ||
|
||||||
command == context.stringtable.get (CMD_SUMMARY, "summary") ||
|
command == "summary" ||
|
||||||
command == context.stringtable.get (CMD_TAGS, "tags") ||
|
command == "tags" ||
|
||||||
command == context.stringtable.get (CMD_TIMESHEET, "timesheet") ||
|
command == "timesheet" ||
|
||||||
command == context.stringtable.get (CMD_VERSION, "version") ||
|
command == "version" ||
|
||||||
validCustom (command))
|
validCustom (command))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -285,22 +282,22 @@ bool Cmd::isReadOnlyCommand ()
|
||||||
// Commands that directly modify the data files.
|
// Commands that directly modify the data files.
|
||||||
bool Cmd::isWriteCommand ()
|
bool Cmd::isWriteCommand ()
|
||||||
{
|
{
|
||||||
if (command == context.stringtable.get (CMD_MERGE, "merge") ||
|
if (command == "merge" ||
|
||||||
command == context.stringtable.get (CMD_ADD, "add") ||
|
command == "add" ||
|
||||||
command == context.stringtable.get (CMD_APPEND, "append") ||
|
command == "append" ||
|
||||||
command == context.stringtable.get (CMD_ANNOTATE, "annotate") ||
|
command == "annotate" ||
|
||||||
command == context.stringtable.get (CMD_DENOTATE, "denotate") ||
|
command == "denotate" ||
|
||||||
command == context.stringtable.get (CMD_DELETE, "delete") ||
|
command == "delete" ||
|
||||||
command == context.stringtable.get (CMD_DONE, "done") ||
|
command == "done" ||
|
||||||
command == context.stringtable.get (CMD_DUPLICATE, "duplicate") ||
|
command == "duplicate" ||
|
||||||
command == context.stringtable.get (CMD_EDIT, "edit") ||
|
command == "edit" ||
|
||||||
command == context.stringtable.get (CMD_IMPORT, "import") ||
|
command == "import" ||
|
||||||
command == context.stringtable.get (CMD_LOG, "log") ||
|
command == "log" ||
|
||||||
command == context.stringtable.get (CMD_PREPEND, "prepend") ||
|
command == "prepend" ||
|
||||||
command == context.stringtable.get (CMD_PULL, "pull") ||
|
command == "pull" ||
|
||||||
command == context.stringtable.get (CMD_START, "start") ||
|
command == "start" ||
|
||||||
command == context.stringtable.get (CMD_STOP, "stop") ||
|
command == "stop" ||
|
||||||
command == context.stringtable.get (CMD_UNDO, "undo"))
|
command == "undo")
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -51,7 +51,6 @@ Context::Context ()
|
||||||
, subst ()
|
, subst ()
|
||||||
, task ()
|
, task ()
|
||||||
, tdb ()
|
, tdb ()
|
||||||
, stringtable ()
|
|
||||||
, program ("")
|
, program ("")
|
||||||
, file_override ("")
|
, file_override ("")
|
||||||
, var_overrides ("")
|
, var_overrides ("")
|
||||||
|
@ -135,8 +134,6 @@ void Context::initialize ()
|
||||||
if (config.getBoolean ("color"))
|
if (config.getBoolean ("color"))
|
||||||
initializeColorRules ();
|
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"));
|
Directory location (config.get ("data.location"));
|
||||||
std::string locale = config.get ("locale");
|
std::string locale = config.get ("locale");
|
||||||
|
|
||||||
|
@ -145,9 +142,6 @@ void Context::initialize ()
|
||||||
if (period != std::string::npos)
|
if (period != std::string::npos)
|
||||||
locale = locale.substr (0, period);
|
locale = locale.substr (0, period);
|
||||||
|
|
||||||
if (locale != "")
|
|
||||||
stringtable.load (location.data + "/strings." + locale);
|
|
||||||
|
|
||||||
// init TDB.
|
// init TDB.
|
||||||
tdb.clear ();
|
tdb.clear ();
|
||||||
std::vector <std::string> all;
|
std::vector <std::string> all;
|
||||||
|
@ -175,7 +169,7 @@ int Context::run ()
|
||||||
|
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
footnote (stringtable.get (100, "Unknown error."));
|
footnote ("Unknown error.");
|
||||||
rc = 3;
|
rc = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,10 +459,7 @@ void Context::loadCorrectConfigFile ()
|
||||||
// Set up default locations.
|
// Set up default locations.
|
||||||
struct passwd* pw = getpwuid (getuid ());
|
struct passwd* pw = getpwuid (getuid ());
|
||||||
if (!pw)
|
if (!pw)
|
||||||
throw std::string (
|
throw std::string ("Could not read home directory from the passwd file.");
|
||||||
stringtable.get (
|
|
||||||
SHELL_READ_PASSWD,
|
|
||||||
"Could not read home directory from the passwd file."));
|
|
||||||
|
|
||||||
std::string home = pw->pw_dir;
|
std::string home = pw->pw_dir;
|
||||||
File rc (home + "/.taskrc");
|
File rc (home + "/.taskrc");
|
||||||
|
@ -621,8 +612,7 @@ void Context::parse (
|
||||||
foundNonSequence = true;
|
foundNonSequence = true;
|
||||||
|
|
||||||
if (arg->find (',') != std::string::npos)
|
if (arg->find (',') != std::string::npos)
|
||||||
throw stringtable.get (TAGS_NO_COMMA,
|
throw std::string ("Tags are not permitted to contain commas.");
|
||||||
"Tags are not permitted to contain commas.");
|
|
||||||
|
|
||||||
tagAdditions.push_back (arg->substr (1));
|
tagAdditions.push_back (arg->substr (1));
|
||||||
parseTask.addTag (arg->substr (1));
|
parseTask.addTag (arg->substr (1));
|
||||||
|
@ -640,8 +630,7 @@ void Context::parse (
|
||||||
foundNonSequence = true;
|
foundNonSequence = true;
|
||||||
|
|
||||||
if (arg->find (',') != std::string::npos)
|
if (arg->find (',') != std::string::npos)
|
||||||
throw stringtable.get (TAGS_NO_COMMA,
|
throw std::string ("Tags are not permitted to contain commas.");
|
||||||
"Tags are not permitted to contain commas.");
|
|
||||||
|
|
||||||
tagRemovals.push_back (arg->substr (1));
|
tagRemovals.push_back (arg->substr (1));
|
||||||
}
|
}
|
||||||
|
@ -801,9 +790,7 @@ void Context::parse (
|
||||||
parse (args, cmd, task, sequence, subst, filter);
|
parse (args, cmd, task, sequence, subst, filter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw stringtable.get (
|
throw std::string ("You must specify a command, or a task ID to modify.");
|
||||||
CMD_MISSING,
|
|
||||||
"You must specify a command, or a task ID to modify.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the command "task 123" is entered, but with no modifier arguments,
|
// If the command "task 123" is entered, but with no modifier arguments,
|
||||||
|
@ -831,7 +818,6 @@ void Context::clear ()
|
||||||
// task.clear ();
|
// task.clear ();
|
||||||
task = Task ();
|
task = Task ();
|
||||||
tdb.clear ();
|
tdb.clear ();
|
||||||
// stringtable.clear ();
|
|
||||||
program = "";
|
program = "";
|
||||||
args.clear ();
|
args.clear ();
|
||||||
file_override = "";
|
file_override = "";
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include "Cmd.h"
|
#include "Cmd.h"
|
||||||
#include "Task.h"
|
#include "Task.h"
|
||||||
#include "TDB.h"
|
#include "TDB.h"
|
||||||
#include "StringTable.h"
|
|
||||||
#include "Hooks.h"
|
#include "Hooks.h"
|
||||||
|
|
||||||
class Context
|
class Context
|
||||||
|
@ -84,7 +83,6 @@ public:
|
||||||
Subst subst;
|
Subst subst;
|
||||||
Task task;
|
Task task;
|
||||||
TDB tdb;
|
TDB tdb;
|
||||||
StringTable stringtable;
|
|
||||||
std::string program;
|
std::string program;
|
||||||
std::vector <std::string> args;
|
std::vector <std::string> args;
|
||||||
std::string file_override;
|
std::string file_override;
|
||||||
|
|
|
@ -94,8 +94,7 @@ void Record::parse (const std::string& input)
|
||||||
n.depleted ())
|
n.depleted ())
|
||||||
{
|
{
|
||||||
if (line.length () == 0)
|
if (line.length () == 0)
|
||||||
throw context.stringtable.get (RECORD_EMPTY,
|
throw std::string ("Empty record in input.");
|
||||||
"Empty record in input.");
|
|
||||||
|
|
||||||
Nibbler nl (line);
|
Nibbler nl (line);
|
||||||
Att a;
|
Att a;
|
||||||
|
@ -109,12 +108,10 @@ void Record::parse (const std::string& input)
|
||||||
std::string remainder;
|
std::string remainder;
|
||||||
nl.getUntilEOS (remainder);
|
nl.getUntilEOS (remainder);
|
||||||
if (remainder.length ())
|
if (remainder.length ())
|
||||||
throw context.stringtable.get (RECORD_EXTRA,
|
throw std::string ("Unrecognized characters at end of line.");
|
||||||
"Unrecognized characters at end of line.");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw context.stringtable.get (RECORD_NOT_FF4,
|
throw std::string ("Record not recognized as format 4.");
|
||||||
"Record not recognized as format 4.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -96,7 +96,7 @@ void Sequence::parse (const std::string& input)
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (! validId (range[0]))
|
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 ());
|
int id = atoi (range[0].c_str ());
|
||||||
this->push_back (id);
|
this->push_back (id);
|
||||||
|
@ -107,15 +107,15 @@ void Sequence::parse (const std::string& input)
|
||||||
{
|
{
|
||||||
if (! validId (range[0]) ||
|
if (! validId (range[0]) ||
|
||||||
! validId (range[1]))
|
! 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 low = atoi (range[0].c_str ());
|
||||||
int high = atoi (range[1].c_str ());
|
int high = atoi (range[1].c_str ());
|
||||||
if (low > high)
|
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)
|
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)
|
for (int i = low; i <= high; ++i)
|
||||||
this->push_back (i);
|
this->push_back (i);
|
||||||
|
@ -123,7 +123,7 @@ void Sequence::parse (const std::string& input)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw context.stringtable.get (SEQUENCE_NOT_A_SEQUENCE, "Not a sequence.");
|
throw std::string ("Not a sequence.");
|
||||||
break;
|
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');
|
mGlobal = n.skip ('g');
|
||||||
|
|
||||||
if (mFrom == "")
|
if (mFrom == "")
|
||||||
throw context.stringtable.get (SUBST_EMPTY,
|
throw std::string ("Cannot substitute an empty string.");
|
||||||
"Cannot substitute an empty string.");
|
|
||||||
|
|
||||||
if (!n.depleted ())
|
if (!n.depleted ())
|
||||||
throw context.stringtable.get (SUBST_BAD_CHARS,
|
throw std::string ("Unrecognized character(s) at end of substitution.");
|
||||||
"Unrecognized character(s) at end of substitution.");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw context.stringtable.get (SUBST_MALFORMED,
|
throw std::string ("Malformed substitution.");
|
||||||
"Malformed substitution.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -2497,7 +2497,7 @@ void handleShell ()
|
||||||
|
|
||||||
catch (...)
|
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 (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
std::cerr << context.stringtable.get (100, "Unknown error.") << "\n";
|
std::cerr << "Unknown error." << "\n";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,9 +77,8 @@ int Context::handleInteractive ()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
throw stringtable.get (INTERACTIVE_NO_NCURSES,
|
throw std::string ("Interactive task is only available when built with "
|
||||||
"Interactive task is only available when built with ncurses "
|
"ncurses support.");
|
||||||
"support.");
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,7 @@ bool confirm (const std::string& question)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
std::cout << question
|
std::cout << question
|
||||||
<< " "
|
<< " (y/n) ";
|
||||||
<< context.stringtable.get (CONFIRM_YES_NO, "(y/n)")
|
|
||||||
<< " ";
|
|
||||||
|
|
||||||
std::getline (std::cin, answer);
|
std::getline (std::cin, answer);
|
||||||
answer = std::cin.eof() ? "no" : lowerCase (trim (answer));
|
answer = std::cin.eof() ? "no" : lowerCase (trim (answer));
|
||||||
|
|
1
test/.gitignore
vendored
1
test/.gitignore
vendored
|
@ -22,7 +22,6 @@ rectangle.t
|
||||||
rx.t
|
rx.t
|
||||||
sensor.t
|
sensor.t
|
||||||
seq.t
|
seq.t
|
||||||
stringtable.t
|
|
||||||
subst.t
|
subst.t
|
||||||
t.benchmark.t
|
t.benchmark.t
|
||||||
t.t
|
t.t
|
||||||
|
|
|
@ -3,10 +3,11 @@ include_directories (${CMAKE_SOURCE_DIR}/src
|
||||||
${CMAKE_SOURCE_DIR}/test
|
${CMAKE_SOURCE_DIR}/test
|
||||||
${TASK_INCLUDE_DIRS})
|
${TASK_INCLUDE_DIRS})
|
||||||
|
|
||||||
set (test_SRCS date.t t.t tdb.t duration.t t.benchmark.t text.t autocomplete.t seq.t
|
set (test_SRCS date.t t.t tdb.t duration.t t.benchmark.t text.t autocomplete.t
|
||||||
record.t att.t stringtable.t subst.t nibbler.t filt.t cmd.t config.t
|
seq.t record.t att.t subst.t nibbler.t filt.t cmd.t config.t
|
||||||
util.t color.t list.t path.t file.t grid.t directory.t rx.t taskmod.t
|
util.t color.t list.t path.t file.t grid.t directory.t rx.t
|
||||||
lisp.t rectangle.t sensor.t tree.t tree2.t uri.t json.t)
|
taskmod.t lisp.t rectangle.t sensor.t tree.t tree2.t uri.t
|
||||||
|
json.t)
|
||||||
|
|
||||||
add_custom_target (test ./run_all DEPENDS ${test_SRCS}
|
add_custom_target (test ./run_all DEPENDS ${test_SRCS}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test)
|
||||||
|
|
|
@ -80,7 +80,7 @@ $output = qx{../src/task rc:limit.rc ls limit:3};
|
||||||
like ($output, qr/^30 tasks, 3 shown$/ms, 'limited to 3');
|
like ($output, qr/^30 tasks, 3 shown$/ms, 'limited to 3');
|
||||||
|
|
||||||
$output = qx{../src/task rc:limit.rc ls limit:page};
|
$output = qx{../src/task rc:limit.rc ls limit:page};
|
||||||
like ($output, qr/^30 tasks, truncated to 17 lines$/ms, 'limited to page');
|
like ($output, qr/^30 tasks, truncated to 18 lines$/ms, 'limited to page');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink 'pending.data';
|
||||||
|
|
|
@ -1,61 +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 <unistd.h>
|
|
||||||
#include <Context.h>
|
|
||||||
#include <StringTable.h>
|
|
||||||
#include <File.h>
|
|
||||||
#include <util.h>
|
|
||||||
#include <test.h>
|
|
||||||
|
|
||||||
Context context;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
int main (int argc, char** argv)
|
|
||||||
{
|
|
||||||
UnitTest t (4);
|
|
||||||
|
|
||||||
// Create a string file.
|
|
||||||
std::string file = "./strings.xx-XX";
|
|
||||||
File::write (file, "# comment\n1 found");
|
|
||||||
t.is (access (file.c_str (), F_OK), 0, "strings.xx-XX created.");
|
|
||||||
|
|
||||||
// Load the string file.
|
|
||||||
StringTable st;
|
|
||||||
st.load (file);
|
|
||||||
|
|
||||||
// Test the object.
|
|
||||||
t.is (st.get (1, "nope"), "found", "string 1 'found' found");
|
|
||||||
t.is (st.get (2, "nope"), "nope", "string 2 'nope' defaulted");
|
|
||||||
|
|
||||||
// Clean up.
|
|
||||||
unlink (file.c_str ());
|
|
||||||
t.is (access (file.c_str (), F_OK), -1, "strings.xx-XX removed.");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
Loading…
Add table
Add a link
Reference in a new issue