Browse Source

Mark up text in auco.xml for translation

Neal Wilson 8 years ago
parent
commit
7210368f74
1 changed files with 35 additions and 28 deletions
  1. 35
    28
      config/Reports/auco.xml

+ 35
- 28
config/Reports/auco.xml View File

@@ -5,34 +5,34 @@
5 5
             <daterange id="dates" initial="23" /><!-- Lifetime -->
6 6
             <label>Sort Order:</label>
7 7
             <sqldrop id="sort" />
8
-			<label>Weight Unit:</label>
9
-			<sqldrop id="unit" />
8
+            <label>Weight Unit:</label>
9
+            <sqldrop id="unit" />
10 10
             <stretch />
11 11
         </layout>
12 12
         <webview id="report" />
13 13
     </layout>
14 14
     <menu name="File">
15
-        <item id="print" shortcut="Ctrl+P">Print</item>
15
+        <item id="print" shortcut="Ctrl+P">Print...</item>
16 16
     </menu>
17 17
     <program>
18 18
         <![CDATA[
19
-            this.windowTitle = "Typica - Average Use and Cost by Origin";
19
+            this.windowTitle = TTR("useandcostreport", "Typica - Average Use and Cost by Origin");
20 20
             var report = findChildObject(this, 'report');
21 21
             var printMenu = findChildObject(this, 'print');
22 22
             printMenu.triggered.connect(function() {
23 23
                 report.print();
24 24
             });
25 25
             var sortBox = findChildObject(this, 'sort');
26
-            sortBox.addItem("Origin A-Z");
27
-            sortBox.addItem("Origin Z-A");
28
-            sortBox.addItem("Avg. Rate Ascending");
29
-            sortBox.addItem("Avg. Rate Descending");
30
-            sortBox.addItem("Avg. Cost Ascending");
31
-            sortBox.addItem("Avg. Cost Descending");
26
+            sortBox.addItem(TTR("useandcostreport","Origin A-Z"));
27
+            sortBox.addItem(TTR("useandcostreport", "Origin Z-A"));
28
+            sortBox.addItem(TTR("useandcostreport", "Avg. Rate Ascending"));
29
+            sortBox.addItem(TTR("useandcostreport", "Avg. Rate Descending"));
30
+            sortBox.addItem(TTR("useandcostreport", "Avg. Cost Ascending"));
31
+            sortBox.addItem(TTR("useandcostreport", "Avg. Cost Descending"));
32 32
             sortBox.currentIndex = QSettings.value("auco_sort", 0);
33 33
             var unitBox = findChildObject(this, 'unit');
34
-            unitBox.addItem("Kg");
35
-            unitBox.addItem("Lb");
34
+            unitBox.addItem(TTR("useandcostreport", "Kg"));
35
+            unitBox.addItem(TTR("useandcostreport", "Lb"));
36 36
             unitBox.currentIndex = QSettings.value("script/report_unit", 1);
37 37
             unitBox['currentIndexChanged(int)'].connect(function() {
38 38
                 QSettings.setValue("script/report_unit", unitBox.currentIndex);
@@ -68,17 +68,17 @@
68 68
                 output.writeStartElement("html");
69 69
                 output.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml");
70 70
                 output.writeStartElement("head");
71
-                output.writeTextElement("title", "Recent Use and Cost by Origin");
71
+                output.writeTextElement("title", TTR("useandcostreport", "Recent Use and Cost by Origin"));
72 72
                 output.writeEndElement();
73 73
                 output.writeStartElement("body");
74
-                output.writeTextElement("h1", "Average Use and Cost by Origin " + startDate + " - " + endDate);
74
+                output.writeTextElement("h1", TTR("useandcostreport", "Average Use and Cost by Origin ") + startDate + " - " + endDate);
75 75
                 switch(unitBox.currentIndex)
76 76
                 {
77 77
                     case 0:
78
-                        output.writeTextElement("p", "This is a report of average rate of use in kilograms per day and cost of unroasted coffee.");
78
+                        output.writeTextElement("p", TTR("useandcostreport", "This is a report of average rate of use in kilograms per day and cost of unroasted coffee."));
79 79
                             break;
80 80
                     case 1:
81
-                        output.writeTextElement("p", "This is a report of average rate of use in pounds per day and cost of unroasted coffee.");
81
+                        output.writeTextElement("p", TTR("useandcostreport", "This is a report of average rate of use in pounds per day and cost of unroasted coffee."));
82 82
                     break;
83 83
                 }
84 84
                 output.writeStartElement("table");
@@ -88,19 +88,19 @@
88 88
                 output.writeStartElement("tr");
89 89
                 output.writeStartElement("th");
90 90
                 output.writeAttribute("colspan", "9");
91
-                output.writeCharacters("Regular Coffees");
91
+                output.writeCharacters(TTR("useandcostreport", "Regular Coffees"));
92 92
                 output.writeEndElement();
93 93
                 output.writeEndElement();
94 94
                 output.writeStartElement("tr");
95
-                output.writeTextElement("th", "Origin");
96
-                output.writeTextElement("th", "Avg. Rate");
97
-                output.writeTextElement("th", "Avg. Cost");
98
-                output.writeTextElement("th", "Last Cost");
99
-                output.writeTextElement("th", "Last Purchase Date");
100
-                output.writeTextElement("th", "Bag Size (min)");
101
-                output.writeTextElement("th", "Bag Size (max)");
102
-                output.writeTextElement("th", "Bag Size (mean)");
103
-                output.writeTextElement("th", "Purchases");
95
+                output.writeTextElement("th", TTR("useandcostreport", "Origin"));
96
+                output.writeTextElement("th", TTR("useandcostreport", "Avg. Rate"));
97
+                output.writeTextElement("th", TTR("useandcostreport", "Avg. Cost"));
98
+                output.writeTextElement("th", TTR("useandcostreport", "Last Cost"));
99
+                output.writeTextElement("th", TTR("useandcostreport", "Last Purchase Date"));
100
+                output.writeTextElement("th", TTR("useandcostreport", "Bag Size (min)"));
101
+                output.writeTextElement("th", TTR("useandcostreport", "Bag Size (max)"));
102
+                output.writeTextElement("th", TTR("useandcostreport", "Bag Size (mean)"));
103
+                output.writeTextElement("th", TTR("useandcostreport", "Purchases"));
104 104
                 output.writeEndElement();
105 105
                 output.writeEndElement();
106 106
                 output.writeStartElement("tbody");
@@ -164,7 +164,7 @@
164 164
                 output.writeStartElement("tr");
165 165
                 output.writeStartElement("th");
166 166
                 output.writeAttribute("colspan", "9");
167
-                output.writeCharacters("Decaffeinated Coffees");
167
+                output.writeCharacters(TTR("useandcostreport", "Decaffeinated Coffees"));
168 168
                 output.writeEndElement();
169 169
                 output.writeEndElement();
170 170
                 query.prepare("WITH q AS (SELECT id, origin, rate/:c1 AS rate, (SELECT cost*:c2 FROM purchase WHERE item = id) AS cost, (SELECT min(time) FROM purchase WHERE item = id) AS purchase_time, (SELECT conversion/:c3 FROM lb_bag_conversion WHERE item = id) AS bag_weight FROM coffee_history WHERE id IN (SELECT id FROM decaf_coffees) AND id IN (SELECT item FROM transactions WHERE time >= :startDate AND time < :endDate::date + interval '1 day')) SELECT DISTINCT origin, avg(rate)::numeric(10,2) AS rate, avg(cost)::numeric(10,2) AS cost, (SELECT (cost*:c4)::numeric(10,2) FROM purchase WHERE item = max(q.id)) AS last_cost, max(purchase_time)::date AS last_purchase, min(bag_weight)::numeric(10,2) AS min_weight, max(bag_weight)::numeric(10,2) AS max_weight, avg(bag_weight)::numeric(10,2) AS mean_weight, count(1) AS n FROM q GROUP BY origin ORDER BY " + orderClause);
@@ -229,7 +229,14 @@
229 229
                     tableref = "decaf_coffees";
230 230
                 }
231 231
                 var origin = rowData[Number(url.slice(1, url.length))];
232
-                var details = '<tr><td /><td colspan="6"><table><tr><th>Id</th><th>Name</th><th>Rate</th><th>Cost</th><th>Inventory</th><th>First Use</th><th>Last Use</th></tr>';
232
+                var details = '<tr><td /><td colspan="6"><table><tr><th>' +
233
+                                    TTR("useandcostreport", "Id") + '</th><th>' +
234
+                                    TTR("useandcostreport", "Name") + '</th><th>' +
235
+                                    TTR("useandcostreport", "Rate") + '</th><th>' +
236
+                                    TTR("useandcostreport", "Cost") + '</th><th>' +
237
+                                    TTR("useandcostreport", "Inventory") + '</th><th>' +
238
+                                    TTR("useandcostreport", "First Use") + '</th><th>' +
239
+                                    TTR("useandcostreport", "Last Use") + '</th></tr>';
233 240
                 var query = new QSqlQuery();
234 241
                 query.prepare("SELECT id, name, (rate/:conversion1)::numeric(12,3), (SELECT (cost*:conversion2)::numeric(12,2) FROM purchase WHERE item = id), (stock/:conversion3)::numeric(12,3), (SELECT min(time)::date FROM use WHERE item = id) AS first_use, (SELECT max(time)::date FROM use WHERE item = id) AS last_use FROM coffee_history WHERE origin = :origin AND id IN (SELECT id FROM " + tableref + ") AND id IN (SELECT item FROM transactions WHERE time >= :startDate AND time < :endDate::date + interval '1 day') ORDER BY first_use DESC");
235 242
                 var conversion = 1;

Loading…
Cancel
Save