diff --git a/src/commands/CmdHelp.cpp b/src/commands/CmdHelp.cpp index 4f43aa850..4268f866d 100644 --- a/src/commands/CmdHelp.cpp +++ b/src/commands/CmdHelp.cpp @@ -25,10 +25,14 @@ // //////////////////////////////////////////////////////////////////////////////// +#define L10N // Localization complete. + #include #include #include #include +#include +#include #include extern Context context; @@ -38,7 +42,7 @@ CmdHelp::CmdHelp () { _keyword = "help"; _usage = "task help"; - _description = "Displays this usage help text"; + _description = STRING_CMD_HELP_USAGE; _read_only = true; _displays_id = false; } @@ -54,9 +58,9 @@ int CmdHelp::execute (std::string& output) // Static first row. int row = view.addRow (); - view.set (row, 0, "Usage:"); + view.set (row, 0, STRING_CMD_HELP_USAGE_LABEL); view.set (row, 1, "task"); - view.set (row, 2, "Runs rc.default.command, if specified."); + view.set (row, 2, STRING_CMD_HELP_USAGE_DESC); // Obsolete method of getting a list of all commands. std::vector all; @@ -101,89 +105,13 @@ int CmdHelp::execute (std::string& output) { row = view.addRow (); view.set (row, 1, alias->first); - view.set (row, 2, "Aliased to '" + alias->second + "'"); + view.set (row, 2, format (STRING_CMD_HELP_ALIASED, alias->second)); } output = "\n" + view.render () + "\n" - + "Documentation for taskwarrior can be found using 'man task', " - "'man taskrc', 'man task-tutorial', 'man task-color', 'man task-faq' " - "or at http://taskwarrior.org" - + "\n" - + "\n" - - + "\n" - " Used to restrict the visible data.\n" - "\n" - - + "\n" - " Changes to apply to the filtered data.\n" - "\n" - - + "ID is the numeric identifier displayed by the 'task list' command. " - "You can specify multiple IDs for task commands, and multiple tasks " - "will be affected. To specify multiple IDs make sure you use one " - "of these forms:\n" - " task delete 1,2,3\n" - " task info 1-3\n" - " task pri:H 1,2-5,19\n" - "\n" - "Tags are arbitrary words, any quantity:\n" - " +tag The + means add the tag\n" - " -tag The - means remove the tag\n" - "\n" - "Attributes are:\n" - " project: Project name\n" - " priority: Priority\n" - " due: Due date\n" - " recur: Recurrence frequency\n" - " until: Recurrence end date\n" - " fg: Foreground color\n" - " bg: Background color\n" - " limit: Desired number of rows in report, or 'page'\n" - " wait: Date until task becomes pending\n" - "\n" - "Attribute modifiers improve filters. Supported modifiers are:\n" - " before (synonyms under, below)\n" - " after (synonyms over, above)\n" - " none\n" - " any\n" - " is (synonym equals)\n" - " isnt (synonym not)\n" - " has (synonym contains)\n" - " hasnt\n" - " startswith (synonym left)\n" - " endswith (synonym right)\n" - " word\n" - " noword\n" - "\n" - " For example:\n" - " task list due.before:eom priority.not:L\n" - "\n" - " Modifiers can be inverted with the ~ character:\n" - " project.~is is equivalent to project.isnt\n" - "\n" - "The default .taskrc file can be overridden with:\n" - " task rc: ...\n" - "\n" - "The values in .taskrc (or alternate) can be overridden with:\n" - " task ... rc.:\n" - "\n" - "Any command or attribute name may be abbreviated if still unique:\n" - " task list project:Home\n" - " task li pro:Home\n" - "\n" - "Some task descriptions need to be escaped because of the shell:\n" - " task add \"quoted ' quote\"\n" - " task add escaped \\' quote\n" - "\n" - "The argument -- tells taskwarrior to treat all other args as description.\n" - " task add -- project:Home needs scheduling\n" - "\n" - "Many characters have special meaning to the shell, including:\n" - " $ ! ' \" ( ) ; \\ ` * ? { } [ ] < > | & % # ~\n" - "\n"; + + STRING_CMD_HELP_TEXT; return 0; } diff --git a/src/en-US.h b/src/en-US.h index 12ff7ebd4..2d6c3269c 100644 --- a/src/en-US.h +++ b/src/en-US.h @@ -36,7 +36,7 @@ // - text output that the user sees // // Strings that should NOT be localized: -// - ./taskrc configuration variable names +// - .taskrc configuration variable names // - command names // - extension function names // - certain literals associated with parsing @@ -46,8 +46,8 @@ // - logical operators (and, or, xor) // // Rules: -// - Localized strings should contain leading or trailing white space, -// including \n, thus allowing the code to compose strings. +// - Localized strings should not in general contain leading or trailing +// white space, including \n, thus allowing the code to compose strings. // - Retain the tense of the original string. // - Retain the same degree of verbosity of the original string. // @@ -429,6 +429,10 @@ #define STRING_CMD_BURN_DONE "Done" // Must be 7 or fewer characters #define STRING_CMD_BURN_PENDING "Pending" // Must be 7 or fewer characters #define STRING_CMD_BURN_NO_CONVERGE "No convergence" +#define STRING_CMD_HELP_USAGE "Displays this usage help text" +#define STRING_CMD_HELP_USAGE_LABEL "Usage:" +#define STRING_CMD_HELP_USAGE_DESC "Runs rc.default.command, if specified." +#define STRING_CMD_HELP_ALIASED "Aliased to '{1}'" // Config #define STRING_CONFIG_OVERNEST "Configuration file nested to more than 10 levels deep - this has to be a mistake." @@ -594,6 +598,108 @@ #define STRING_UTF8_INVALID_CP_REP "Invalid codepoint representation." #define STRING_UTF8_INVALID_CP "Invalid Unicode codepoint." +// Usage text. This is an exception, and contains \n characters and formatting. +#define STRING_CMD_HELP_TEXT \ + "Documentation for Taskwarrior can be found using 'man task', 'man taskrc', 'man " \ + "task-tutorial', 'man task-color', 'man task-faq', 'man task-synch or at " \ + "http://taskwarrior.org\n" \ + "\n" \ + "The general form of commands is:\n" \ + " task \n" \ + "\n" \ + "The consists of zero or more restrictions on which tasks to select, " \ + "such as:\n" \ + " task \n" \ + " task 28 \n" \ + " task +weekend \n" \ + " task project:Home due.before:today \n" \ + " task ebeeab00-ccf8-464b-8b58-f7f2d606edfb \n" \ + "\n" \ + "By default, filter elements are combined with an implicit 'and' operator, but " \ + "'or' and 'xor' may also be used, provided parentheses are included:\n" \ + " task '(/[Cc]at|[Dd]og/ or /[0-9]+/)' \n" \ + "\n" \ + "A filter may target specific tasks using ID or UUID numbers. To specify " \ + "multiple tasks use one of these forms:\n" \ + " task 1,2,3 delete\n" \ + " task 1-3 info\n" \ + " task 1,2-5,19 modify pri:H\n" \ + " task 4-7 ebeeab00-ccf8-464b-8b58-f7f2d606edfb info\n" \ + "\n" \ + "The consist of zero or more changes to apply to the selected " \ + "tasks, such as:\n" \ + " task project:Home\n" \ + " task +weekend +garden due:tomorrow\n" \ + " task Description/annotation text\n" \ + "\n" \ + "Tags are arbitrary words, any quantity:\n" \ + " +tag The + means add the tag\n" \ + " -tag The - means remove the tag\n" \ + "\n" \ + "Built-in attributes are:\n" \ + " description: Task description text\n" \ + " status: Status of task - pending, completed, deleted, waiting\n" \ + " project: Project name\n" \ + " priority: Priority\n" \ + " due: Due date\n" \ + " recur: Recurrence frequency\n" \ + " until: Recurrence end date\n" \ + " limit: Desired number of rows in report, or 'page'\n" \ + " wait: Date until task becomes pending\n" \ + " entry: Date task was created\n" \ + " end: Date task was completed/deleted\n" \ + " start: Date task was started\n" \ + "\n" \ + "Attribute modifiers make filters more precise. Supported modifiers are:\n" \ + " before (synonyms under, below)\n" \ + " after (synonyms over, above)\n" \ + " none\n" \ + " any\n" \ + " is (synonym equals)\n" \ + " isnt (synonym not)\n" \ + " has (synonym contains)\n" \ + " hasnt\n" \ + " startswith (synonym left)\n" \ + " endswith (synonym right)\n" \ + " word\n" \ + " noword\n" \ + "\n" \ + "Alternately algebraic expressions support:\n" \ + " and or xor Logical operators\n" \ + " < <= = != >= > Relational operators\n" \ + " + - Addition, subtraction\n" \ + " ! Inversion\n" \ + " ~ !~ Match, no match\n" \ + " ( ) Precedence\n" \ + "\n" \ + " For example:\n" \ + " task due.before:eom priority.not:L list\n" \ + " task '(due < eom or priority != L)' list\n" \ + "\n" \ + "The default .taskrc file can be overridden with:\n" \ + " task ... rc: ...\n" \ + " task ... rc:~/.alt_taskrc ...\n" \ + "\n" \ + "The values in .taskrc (or alternate) can be overridden with:\n" \ + " task ... rc.= ...\n" \ + " task rc.color=off list\n" \ + "\n" \ + "Any command or attribute name may be abbreviated if still unique:\n" \ + " task list project:Home\n" \ + " task li pro:Home\n" \ + "\n" \ + "Some task descriptions need to be escaped because of the shell:\n" \ + " task add \"quoted ' quote\"\n" \ + " task add escaped \\' quote\n" \ + "\n" \ + "The argument -- tells taskwarrior to treat all other args as description, even " \ + "if they would otherwise be attributes or tags:\n" \ + " task add -- project:Home needs scheduling\n" \ + "\n" \ + "Many characters have special meaning to the shell, including:\n" \ + " $ ! ' \" ( ) ; \\ ` * ? { } [ ] < > | & % # ~\n" \ + "\n" + // util #define STRING_UTIL_CONFIRM_YN " (y/n) " #define STRING_UTIL_CONFIRM_YES "yes"