Browse Source

Make search operators translatable

John R. Supplee 4 years ago
parent
commit
50b25572f1
2 changed files with 24 additions and 15 deletions
  1. 12 14
      client/components/main/globalSearch.js
  2. 12 1
      i18n/en.i18n.json

+ 12 - 14
client/components/main/globalSearch.js

@@ -106,20 +106,18 @@ BlazeComponent.extendComponent({
           const reOperator2 = /^(?<operator>\w+):(?<quote>["']*)(?<value>.*?)\k<quote>(\s+|$)/;
           const reOperator2 = /^(?<operator>\w+):(?<quote>["']*)(?<value>.*?)\k<quote>(\s+|$)/;
           const reText = /^(?<text>\S+)(\s+|$)/;
           const reText = /^(?<text>\S+)(\s+|$)/;
           const reQuotedText = /^(?<quote>["'])(?<text>\w+)\k<quote>(\s+|$)/;
           const reQuotedText = /^(?<quote>["'])(?<text>\w+)\k<quote>(\s+|$)/;
-          const operatorMap = {
-            board: 'boards',
-            b: 'boards',
-            label: 'labels',
-            lable: 'labels',
-            user: 'users',
-            u: 'users',
-            swimlane: 'swimlanes',
-            swim: 'swimlanes',
-            s: 'swimlanes',
-            list: 'lists',
-            l: 'lists',
-            is: 'is',
-          };
+          const operatorMap = {};
+          operatorMap[TAPi18n.__('operator-board')] = 'boards';
+          operatorMap[TAPi18n.__('operator-board-abbrev')] = 'boards';
+          operatorMap[TAPi18n.__('operator-swimlane')] = 'swimlanes';
+          operatorMap[TAPi18n.__('operator-swimlane-abbrev')] = 'swimlanes';
+          operatorMap[TAPi18n.__('operator-list')] = 'lists';
+          operatorMap[TAPi18n.__('operator-list-abbrev')] = 'lists';
+          operatorMap[TAPi18n.__('operator-label')] = 'labels';
+          operatorMap[TAPi18n.__('operator-label-abbrev')] = 'labels';
+          operatorMap[TAPi18n.__('operator-user')] = 'users';
+          operatorMap[TAPi18n.__('operator-user-abbrev')] = 'users';
+          operatorMap[TAPi18n.__('operator-is')] = 'is';
           const selector = {
           const selector = {
             boards: [],
             boards: [],
             swimlanes: [],
             swimlanes: [],

+ 12 - 1
i18n/en.i18n.json

@@ -871,5 +871,16 @@
   "user-username-not-found": "Username '%s' not found.",
   "user-username-not-found": "Username '%s' not found.",
   "globalSearch-title": "Search All Boards",
   "globalSearch-title": "Search All Boards",
   "one-results": "One Result",
   "one-results": "One Result",
-  "n-results": "%s Results"
+  "n-results": "%s Results",
+  "operator-board": "board",
+  "operator-board-abbrev": "b",
+  "operator-swimlane": "swimlane",
+  "operator-swimlane-abbrev": "s",
+  "operator-list": "list",
+  "operator-list-abbrev": "l",
+  "operator-label": "label",
+  "operator-label-abbrev": "lbl",
+  "operator-user": "user",
+  "operator-user-abbrev": "u",
+  "operator-is": "is"
 }
 }