瀏覽代碼

Convert global search instructions to translatable tags

John R. Supplee 4 年之前
父節點
當前提交
8059856c39

+ 1 - 21
client/components/main/globalSearch.jade

@@ -30,28 +30,8 @@ template(name="globalSearch")
             +resultCard(card)
       else
         .global-search-instructions
-          h1 Search Operators
           +viewer
-            = 'Searches can include operators to refine the search.  Operators are specified by writing the operator'
-            = 'name and value separated by a colon.  For example, an operator specification of `list:Blocked` would limit the search'
-            = 'to cards that are contained in a list named *Blocked*.  If the value contains spaces or special characters'
-            = 'it must be enclosed in quotation marks (e.g. `list:"To Review"`).\n'
-            = 'Available operators are:\n'
-            = '* `board:title` - cards in boards matching the specified title\n'
-            = '* `list:title` - cards in lists matching the specified title\n'
-            = '* `swimlane:title` - cards in swimlanes matching the specified title\n'
-            = '* `label:color` - cards that have a label matching the given color\n'
-            = '* `label:name` - cards that have a label matching the given name\n'
-            = '* `user:username` - cards where the specified user is a member or assignee\n'
-            = '* `@username` - shorthand for `user:username`\n'
-            = '* `#label` - shorthand for `label:color-or-name`\n'
-            = '## Notes\n'
-            = '*  Multiple operators may be specified.\n'
-            = '*  Similar operators are *OR*ed together.  Cards that match any of the conditions will be returned.\n'
-            = '    `list:Available list:Blocked` would return cards contained in any list named *Blocked* or *Available*.\n'
-            = '*  Differing operators are *AND*ed together.  Only cards that match all of the differing operators are returned.\n'
-            = '`list:Available label:red` returns only cards in the list *Available* with a *red* label.\n'
-            = '* Text searches are case insensitive.\n'
+            = searchInstructions
 
 template(name="globalSearchViewChangePopup")
   if currentUser

+ 50 - 0
client/components/main/globalSearch.js

@@ -102,6 +102,56 @@ BlazeComponent.extendComponent({
     });
   },
 
+  searchInstructions() {
+    tags = {
+      operator_board: TAPi18n.__('operator-board'),
+      operator_list: TAPi18n.__('operator-list'),
+      operator_swimlane: TAPi18n.__('operator-swimlane'),
+      operator_label: TAPi18n.__('operator-label'),
+      operator_label_abbrev: TAPi18n.__('operator-label-abbrev'),
+      operator_user: TAPi18n.__('operator-user'),
+      operator_user_abbrev: TAPi18n.__('operator-user-abbrev'),
+    };
+
+    text = `# ${TAPi18n.__('globalSearch-instructions-heading')}`;
+    text += `\n${TAPi18n.__('globalSearch-instructions-description', tags)}`;
+    text += `\n${TAPi18n.__('globalSearch-instructions-operators', tags)}`;
+    text += `\n* ${TAPi18n.__(
+      'globalSearch-instructions-operator-board',
+      tags,
+    )}`;
+    text += `\n* ${TAPi18n.__(
+      'globalSearch-instructions-operator-list',
+      tags,
+    )}`;
+    text += `\n* ${TAPi18n.__(
+      'globalSearch-instructions-operator-swimlane',
+      tags,
+    )}`;
+    text += `\n* ${TAPi18n.__(
+      'globalSearch-instructions-operator-label',
+      tags,
+    )}`;
+    text += `\n* ${TAPi18n.__(
+      'globalSearch-instructions-operator-hash',
+      tags,
+    )}`;
+    text += `\n* ${TAPi18n.__(
+      'globalSearch-instructions-operator-user',
+      tags,
+    )}`;
+    text += `\n* ${TAPi18n.__('globalSearch-instructions-operator-at', tags)}`;
+
+    text += `\n## ${TAPi18n.__('heading-notes')}`;
+    text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-1', tags)}`;
+    text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-2', tags)}`;
+    text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-3', tags)}`;
+    text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-4', tags)}`;
+    text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-5', tags)}`;
+
+    return text;
+  },
+
   events() {
     return [
       {

+ 2 - 2
client/components/main/globalSearch.styl

@@ -91,7 +91,7 @@
   font-style: italic
 
 code
-  color: white
-  background-color: grey
+  color: black
+  background-color: lightgrey
   padding: 0.1rem !important
   font-size: 0.7rem !important

+ 17 - 1
i18n/en.i18n.json

@@ -885,5 +885,21 @@
   "operator-label-abbrev": "#",
   "operator-user": "user",
   "operator-user-abbrev": "@",
-  "operator-is": "is"
+  "operator-is": "is",
+  "heading-notes": "Notes",
+  "globalSearch-instructions-heading": "Search Instructions",
+  "globalSearch-instructions-description": "Searches can include operators to refine the search.  Operators are specified by writing the operator name and value separated by a colon.  For example, an operator specification of `list:Blocked` would limit the search to cards that are contained in a list named *Blocked*.  If the value contains spaces or special characters it must be enclosed in quotation marks (e.g. `__operator_list__:\"To Review\"`).",
+  "globalSearch-instructions-operators": "Available operators:",
+  "globalSearch-instructions-operator-board": "`__operator_board__:title` - cards in boards matching the specified title",
+  "globalSearch-instructions-operator-list": "`__operator_list__:title` - cards in lists matching the specified title",
+  "globalSearch-instructions-operator-swimlane": "`__operator_swimlane__:title` - cards in swimlanes matching the specified title",
+  "globalSearch-instructions-operator-label": "`__operator_label__:color` `__operator_label__:name` - cards that have a label matching the given color or name",
+  "globalSearch-instructions-operator-hash": "`__operator_label_abbrev__label` - shorthand for `__operator_label__:label`",
+  "globalSearch-instructions-operator-user": "`__operator_user__:username` - cards where the specified user is a *member* or *assignee*",
+  "globalSearch-instructions-operator-at": "`__operator_user_abbrev__username` - shorthand for `user:username`",
+  "globalSearch-instructions-notes-1": "Multiple operators may be specified.",
+  "globalSearch-instructions-notes-2": "Similar operators are *OR*ed together.  Cards that match any of the conditions will be returned.\n`__operator_list__:Available __operator_list__:Blocked` would return cards contained in any list named *Blocked* or *Available*.",
+  "globalSearch-instructions-notes-3": "Differing operators are *AND*ed together.  Only cards that match all of the differing operators are returned.\n`__operator_list__:Available __operator_label__:red` returns only cards in the list *Available* with a *red* label.",
+  "globalSearch-instructions-notes-4": "Text searches are case insensitive.",
+  "globalSearch-instructions-notes-5": "Currently archived cards are not searched."
 }