handlebars-i18n-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +15 -0
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/bin/i18n-collect +4 -0
- package/examples/generated/translations.json +145 -0
- package/examples/templates/sample-template.html +363 -0
- package/package.json +49 -0
- package/src/i18n-collect.js +561 -0
- package/test/handlebars-i18n-cli.test.js +174 -0
- package/test/test-assets/custom-func.html +10 -0
- package/test/test-assets/empty.html +9 -0
- package/test/test-assets/multiple.html +12 -0
- package/test/test-assets/simple.html +10 -0
- package/test/test-generated/test-12.json +8 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="{{_locale}}">
|
|
3
|
+
<head>
|
|
4
|
+
<title>{{__ Sample_invoice_title}}</title>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<style>
|
|
7
|
+
/* Tags
|
|
8
|
+
---------------------------------------- */
|
|
9
|
+
* { box-sizing: border-box; }
|
|
10
|
+
body {
|
|
11
|
+
margin: 0 9mm 0 18mm;
|
|
12
|
+
width: 129.3mm;
|
|
13
|
+
font-family: Helvetica, Arial, sans-serif;
|
|
14
|
+
font-size: 2.75mm;
|
|
15
|
+
line-height: 130%;
|
|
16
|
+
}
|
|
17
|
+
h1 {
|
|
18
|
+
clear: both;
|
|
19
|
+
font-size: 2.75mm;
|
|
20
|
+
font-weight: 700;
|
|
21
|
+
text-transform: uppercase;
|
|
22
|
+
letter-spacing: .1mm;
|
|
23
|
+
margin: 3mm 0 4mm 0;
|
|
24
|
+
}
|
|
25
|
+
p { margin: 2mm 0 2mm 0; }
|
|
26
|
+
table {
|
|
27
|
+
font-size: 2.25mm;
|
|
28
|
+
border-spacing: 0;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
thead { color: #005D83; }
|
|
32
|
+
th, td {
|
|
33
|
+
vertical-align: top;
|
|
34
|
+
border-width: 0;
|
|
35
|
+
}
|
|
36
|
+
th { padding: 0.5mm 1.5mm 1mm 0; }
|
|
37
|
+
td { padding: 0.5mm 1.5mm 2mm 0; }
|
|
38
|
+
strong { font-weight: 600; }
|
|
39
|
+
</style>
|
|
40
|
+
</head>
|
|
41
|
+
<body>
|
|
42
|
+
<!-- Address sender line (small) -->
|
|
43
|
+
<div class="sender">
|
|
44
|
+
<span>{{__ Company_slogan}}</span><br>
|
|
45
|
+
{{#each sender.adressLines}}
|
|
46
|
+
<span>{{this}}</span>
|
|
47
|
+
{{#unless @last}} · {{/unless}}
|
|
48
|
+
{{/each}}
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="clearfix">
|
|
52
|
+
<!-- Address recipient block -->
|
|
53
|
+
<div class="recipient">
|
|
54
|
+
<div class="recipient-deliveryAddress">
|
|
55
|
+
{{#unless (empty recipient.isMale)}}
|
|
56
|
+
<span>
|
|
57
|
+
{{#if recipient.isMale}} {{__ "Mr"}} {{else}} {{__ "Ms"}} {{/if}}
|
|
58
|
+
{{recipient.firstname}} {{recipient.lastname}}
|
|
59
|
+
</span>
|
|
60
|
+
{{/unless}}
|
|
61
|
+
<br>
|
|
62
|
+
{{#each recipient.addressLines}}
|
|
63
|
+
{{this}}
|
|
64
|
+
{{#unless @last}} <br> {{/unless}}
|
|
65
|
+
{{/each}}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{{#each recipient.deliveryAddress}}
|
|
69
|
+
{{#if @first}}
|
|
70
|
+
<span class="underlined"> {{__ "Confirmation.Delivery_Address"}}: <br> </span>
|
|
71
|
+
{{/if}}
|
|
72
|
+
{{this}}
|
|
73
|
+
{{#unless @last}} <br> {{/unless}}
|
|
74
|
+
{{/each}}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<!-- Project block (right) -->
|
|
78
|
+
<div class="project clearfix">
|
|
79
|
+
<div>{{__ "Project_no"}}</div><div><strong>{{info.projectId}}</strong></div>
|
|
80
|
+
<div>{{__ "Receipt_no"}}</div><div>{{info.letterId}}</div>
|
|
81
|
+
<div>{{__ "Your_customer_no"}}</div><div>{{recipient.id}}</div>
|
|
82
|
+
<div>{{__ "Contact_partner"}}</div><div>{{sender.contact}}</div>
|
|
83
|
+
<div>{{__ "Telephone"}}</div><div><a href="{{sender.telHref}}" class="black">{{sender.phone}}</a></div>
|
|
84
|
+
<div class="mb-1">{{__ "E-mail"}}</div><div class="mb-1"><a href="mailto:{{sender.email}}" class="orange">{{sender.email}}</a></div>
|
|
85
|
+
|
|
86
|
+
<div class="mb-1">{{__ "Date_accepted"}}</div><div class="mb-1">{{info.confirmationDate}}</div>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
{{#if recipient.requestId}}
|
|
90
|
+
<div>{{__ "Your_enquiry_no"}}</div><div>{{recipient.requestId}}</div>
|
|
91
|
+
{{/if}}
|
|
92
|
+
{{#if recipient.vendorId}}
|
|
93
|
+
<div>{{__ "Supplier_no"}}</div><div>{{recipient.vendorId}}</div>
|
|
94
|
+
{{/if}}
|
|
95
|
+
{{#if recipient.orderNo}}
|
|
96
|
+
<div>{{__ "Order_no"}}</div><div>{{recipient.orderNo}}</div>
|
|
97
|
+
{{/if}}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<!-- Salutation -->
|
|
102
|
+
<h1>{{__ "Confirmation.Order_confirmation"}}</h1>
|
|
103
|
+
<p>
|
|
104
|
+
{{#if (empty recipient.isMale)}}
|
|
105
|
+
{{__ "Dear_Ladies_and_Gentlemen"}}
|
|
106
|
+
{{else}}
|
|
107
|
+
{{#if recipient.isMale}} {{__ "Dear_Mr"}} {{else}} {{__ "Dear_Ms"}} {{/if}}
|
|
108
|
+
{{recipient.lastname}},
|
|
109
|
+
{{/if}}
|
|
110
|
+
</p>
|
|
111
|
+
<p>
|
|
112
|
+
{{__ "Confirmation.Intro_statement" refLetterId=info.referenceLetterId refLetterDate=info.referenceLetterDate }}
|
|
113
|
+
</p>
|
|
114
|
+
|
|
115
|
+
<!-- Main Table -->
|
|
116
|
+
<table role="container">
|
|
117
|
+
|
|
118
|
+
<!-- Header -->
|
|
119
|
+
<thead role="header" class="header">
|
|
120
|
+
<tr>
|
|
121
|
+
<th class="id">{{__ "Item"}}</th>
|
|
122
|
+
<th class="project-no">{{__ "Description"}}</th>
|
|
123
|
+
<th class="description">{{__ "Material"}}</th>
|
|
124
|
+
<th class="total-amount">{{__ "Quantity"}}</th>
|
|
125
|
+
<th class="single-price">{{__ "UnitPrice"}}</th>
|
|
126
|
+
<th class="total">{{__ "Total"}}</th>
|
|
127
|
+
</tr>
|
|
128
|
+
</thead>
|
|
129
|
+
|
|
130
|
+
<!-- Body -->
|
|
131
|
+
|
|
132
|
+
<!-- Items -->
|
|
133
|
+
{{#each items}}
|
|
134
|
+
|
|
135
|
+
<!-- Item Carry -->
|
|
136
|
+
{{#unless @first}}
|
|
137
|
+
<thead role="header">
|
|
138
|
+
<!-- Main Header Repeat -->
|
|
139
|
+
<tr>
|
|
140
|
+
<th class="id">{{__ "Item"}}</th>
|
|
141
|
+
<th class="project-no">{{__ "Description"}}</th>
|
|
142
|
+
<th class="description">{{__ "Material"}}</th>
|
|
143
|
+
<th class="total-amount">{{__ "Quantity"}}</th>
|
|
144
|
+
<th class="single-price">{{__ "UnitPrice"}}</th>
|
|
145
|
+
<th class="total">{{__ "Total"}}</th>
|
|
146
|
+
</tr>
|
|
147
|
+
<!-- Carry -->
|
|
148
|
+
<tr class="carry">
|
|
149
|
+
<th colspan="2" class="id">{{__ "Carry"}}</th>
|
|
150
|
+
<th colspan="3"> </th>
|
|
151
|
+
<th class="total">{{#elemBefore ../items @index "subtotalWithCurrency"}}{{/elemBefore}}</th>
|
|
152
|
+
</tr>
|
|
153
|
+
</thead>
|
|
154
|
+
{{/unless}}
|
|
155
|
+
|
|
156
|
+
<!-- Item Entry -->
|
|
157
|
+
<tbody role="content">
|
|
158
|
+
<tr class="items">
|
|
159
|
+
<td class="id">{{id}}</td>
|
|
160
|
+
<td class="project-no">{{name}}</td>
|
|
161
|
+
<td class="description">
|
|
162
|
+
{{#each descriptionLines}}
|
|
163
|
+
<span>{{this}}</span><br>
|
|
164
|
+
{{/each}}
|
|
165
|
+
</td>
|
|
166
|
+
<td class="total-amount">{{quantity}}</td>
|
|
167
|
+
<td class="single-price">{{itemPriceWithCurrency}}</td>
|
|
168
|
+
<td class="total">{{totalPriceWithCurrency}}</td>
|
|
169
|
+
</tr>
|
|
170
|
+
</tbody>
|
|
171
|
+
|
|
172
|
+
<!-- Item Subtotal -->
|
|
173
|
+
{{#unless @last}}
|
|
174
|
+
<tbody role="footer">
|
|
175
|
+
<tr class="subtotal pagebreak">
|
|
176
|
+
<td colspan="5" class="id">{{__ "Subtotal"}}</td>
|
|
177
|
+
<td class="total">{{subtotalWithCurrency}}</td>
|
|
178
|
+
</tr>
|
|
179
|
+
</tbody>
|
|
180
|
+
{{/unless}}
|
|
181
|
+
|
|
182
|
+
{{/each}}
|
|
183
|
+
|
|
184
|
+
<!-- Extra Costs -->
|
|
185
|
+
{{#each extraCosts}}
|
|
186
|
+
|
|
187
|
+
<!-- Extra Cost Carry -->
|
|
188
|
+
{{#unless @first}}
|
|
189
|
+
<thead role="header">
|
|
190
|
+
<!-- Main Header Repeat -->
|
|
191
|
+
<tr>
|
|
192
|
+
<th class="id">{{__ "Item"}}</th>
|
|
193
|
+
<th class="project-no">{{__ "Description"}}</th>
|
|
194
|
+
<th class="description">{{__ "Material"}}</th>
|
|
195
|
+
<th class="total-amount">{{__ "Quantity"}}</th>
|
|
196
|
+
<th class="single-price">{{__ "UnitPrice"}}</th>
|
|
197
|
+
<th class="total">{{__ "Total"}}</th>
|
|
198
|
+
</tr>
|
|
199
|
+
<!-- Carry -->
|
|
200
|
+
<tr class="carry">
|
|
201
|
+
<th colspan="2" class="id">{{__ "Carry"}}</th>
|
|
202
|
+
<th colspan="3"> </th>
|
|
203
|
+
<th class="total">{{#elemBefore ../extraCosts @index "subtotalWithCurrency"}}{{/elemBefore}}</th>
|
|
204
|
+
</tr>
|
|
205
|
+
</thead>
|
|
206
|
+
{{/unless}}
|
|
207
|
+
|
|
208
|
+
<!-- Extra Cost Entry -->
|
|
209
|
+
<tbody role="content">
|
|
210
|
+
<tr class="extra-costs">
|
|
211
|
+
<td class="id">{{id}}</td>
|
|
212
|
+
<td class="project-no">{{#if description}} {{description}} {{else}} {{__ "Surcharge"}} {{/if}}</td>
|
|
213
|
+
<td colspan="3"></td>
|
|
214
|
+
<td class="total">{{extraCost}}</td>
|
|
215
|
+
</tr>
|
|
216
|
+
</tbody>
|
|
217
|
+
|
|
218
|
+
<!-- Extra Cost Subtotal -->
|
|
219
|
+
{{#unless @last}}
|
|
220
|
+
<tbody role="footer">
|
|
221
|
+
<tr class="subtotal pagebreak">
|
|
222
|
+
<td colspan="5" class="id">{{__ "Subtotal"}}</td>
|
|
223
|
+
<td class="total">{{ subtotalWithCurrency }}</td>
|
|
224
|
+
</tr>
|
|
225
|
+
</tbody>
|
|
226
|
+
{{/unless}}
|
|
227
|
+
|
|
228
|
+
{{/each}}
|
|
229
|
+
|
|
230
|
+
<!-- Discounts -->
|
|
231
|
+
{{#each discounts}}
|
|
232
|
+
|
|
233
|
+
<!-- Discounts Carry -->
|
|
234
|
+
{{#unless @first}}
|
|
235
|
+
<thead role="header">
|
|
236
|
+
<!-- Main Header Repeat -->
|
|
237
|
+
<tr>
|
|
238
|
+
<th class="id">{{__ "Item"}}</th>
|
|
239
|
+
<th class="project-no">{{__ "Description"}}</th>
|
|
240
|
+
<th class="description">{{__ "Material"}}</th>
|
|
241
|
+
<th class="total-amount">{{__ "Quantity"}}</th>
|
|
242
|
+
<th class="single-price">{{__ "UnitPrice"}}</th>
|
|
243
|
+
<th class="total">{{__ "Total"}}</th>
|
|
244
|
+
</tr>
|
|
245
|
+
<!-- Carry -->
|
|
246
|
+
<tr class="carry">
|
|
247
|
+
<th colspan="2" class="id">{{__ "Carry"}}</th>
|
|
248
|
+
<th colspan="3"> </th>
|
|
249
|
+
<th class="total">{{#elemBefore ../discounts @index "subtotalWithCurrency"}}{{/elemBefore}}</th>
|
|
250
|
+
</tr>
|
|
251
|
+
</thead>
|
|
252
|
+
{{/unless}}
|
|
253
|
+
|
|
254
|
+
<!-- Discounts Entry -->
|
|
255
|
+
<tbody role="content">
|
|
256
|
+
<tr class="discounts">
|
|
257
|
+
<td class="id">{{id}}</td>
|
|
258
|
+
<td class="project-no">{{#if description}} {{description}} {{else}} {{__ "Discount"}} {{/if}}</td>
|
|
259
|
+
<td colspan="3"></td>
|
|
260
|
+
<td class="total">{{discount}}</td>
|
|
261
|
+
</tr>
|
|
262
|
+
</tbody>
|
|
263
|
+
|
|
264
|
+
<!-- Discounts Subtotal -->
|
|
265
|
+
{{#unless @last}}
|
|
266
|
+
<tbody role="footer">
|
|
267
|
+
<tr class="subtotal pagebreak">
|
|
268
|
+
<td colspan="5" class="id">{{__ "Subtotal"}}</td>
|
|
269
|
+
<td class="total">{{ subtotalWithCurrency }}</td>
|
|
270
|
+
</tr>
|
|
271
|
+
</tbody>
|
|
272
|
+
{{/unless}}
|
|
273
|
+
|
|
274
|
+
{{/each}}
|
|
275
|
+
|
|
276
|
+
<!-- Total -->
|
|
277
|
+
<tbody role="footer">
|
|
278
|
+
<tr>
|
|
279
|
+
<td colspan="4"> </td>
|
|
280
|
+
<td>{{__ "Net_price"}}</td>
|
|
281
|
+
<td class="total">{{total.totalNetWithCurrency}}</td>
|
|
282
|
+
</tr>
|
|
283
|
+
<tr>
|
|
284
|
+
<td colspan="4"> </td>
|
|
285
|
+
<td>{{__ "VAT"}} {{info.vat}}%</td>
|
|
286
|
+
<td class="total">{{total.totalVatWithCurrency}}</td>
|
|
287
|
+
</tr>
|
|
288
|
+
<tr>
|
|
289
|
+
<td colspan="4"> </td>
|
|
290
|
+
<td class="heavy">{{__ "Total_price"}}</td>
|
|
291
|
+
<td class="total heavy">{{total.totalGrossWithCurrency}}</td>
|
|
292
|
+
</tr>
|
|
293
|
+
<!-- This is a Hack: DO NOT REMOVE OR CHANGE -->
|
|
294
|
+
<tr>
|
|
295
|
+
<td colspan="4"> </td>
|
|
296
|
+
<td colspan="2"> </td>
|
|
297
|
+
</tr>
|
|
298
|
+
</tbody>
|
|
299
|
+
</table>
|
|
300
|
+
|
|
301
|
+
<!-- Terms and Conditions -->
|
|
302
|
+
<table class="terms">
|
|
303
|
+
<thead>
|
|
304
|
+
<tr>
|
|
305
|
+
<th colspan="3">{{__ "Your_conditions"}}</th>
|
|
306
|
+
</tr>
|
|
307
|
+
</thead>
|
|
308
|
+
<tbody>
|
|
309
|
+
<tr>
|
|
310
|
+
<td> </td>
|
|
311
|
+
<td>{{__ "Delivery_time"}}</td>
|
|
312
|
+
<td>{{_legacy "Working_dayWithCount" count=info.productionTime}} </td>
|
|
313
|
+
</tr>
|
|
314
|
+
<tr>
|
|
315
|
+
<td> </td>
|
|
316
|
+
<td>{{__ "Delivery_date"}}</td>
|
|
317
|
+
<td>{{info.expectedDeliveryDate}}</td>
|
|
318
|
+
</tr>
|
|
319
|
+
<tr>
|
|
320
|
+
<td> </td>
|
|
321
|
+
<td>{{__ "Shipping_terms"}}</td>
|
|
322
|
+
<td>{{_v info.shippingTerms}}</td>
|
|
323
|
+
</tr>
|
|
324
|
+
<tr>
|
|
325
|
+
<td> </td>
|
|
326
|
+
<td>{{__ "Payment_terms"}}</td>
|
|
327
|
+
<td>{{_v info.paymentTerms}}</td>
|
|
328
|
+
</tr>
|
|
329
|
+
</tbody>
|
|
330
|
+
</table>
|
|
331
|
+
|
|
332
|
+
<!-- Optional Comment Field -->
|
|
333
|
+
{{#if info.comments.[0]}}
|
|
334
|
+
<div class="comment-field">
|
|
335
|
+
<div class="title">{{__ "Special_remarks"}}</div>
|
|
336
|
+
{{#each info.comments}}
|
|
337
|
+
<p>{{this}}</p>
|
|
338
|
+
{{/each}}
|
|
339
|
+
</div>
|
|
340
|
+
{{/if}}
|
|
341
|
+
|
|
342
|
+
<!-- End Statement -->
|
|
343
|
+
<div class="ending">
|
|
344
|
+
|
|
345
|
+
{{#if info.isEU}}
|
|
346
|
+
<p>
|
|
347
|
+
{{__ "Confirmation.NoVat_requires_TaxId"}}
|
|
348
|
+
</p>
|
|
349
|
+
{{/if}}
|
|
350
|
+
|
|
351
|
+
<p>
|
|
352
|
+
{{__ "Confirmation.General_Sale_and_Delivery_Terms" webAgb=sender.webAgb }}
|
|
353
|
+
</p>
|
|
354
|
+
<p>
|
|
355
|
+
{{__ "Should_you_have_questions" telHref=sender.telHref phone=sender.phone}}
|
|
356
|
+
</p>
|
|
357
|
+
<p>
|
|
358
|
+
{{__ "Kind_regards"}}<br>
|
|
359
|
+
{{sender.contact}}
|
|
360
|
+
</p>
|
|
361
|
+
</div>
|
|
362
|
+
</body>
|
|
363
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "handlebars-i18n-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A CLI tool to support node module handlebars-i18n",
|
|
5
|
+
"main": "./src/i18n-collect.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"@fwalzel/handlebars-i18n-cli": "./bin/i18n-collect",
|
|
8
|
+
"i18n-collect": "./bin/i18n-collect"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "nyc mocha",
|
|
15
|
+
"coveralls": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
|
|
16
|
+
"i18n-collect": "cd bin && node i18n-collect"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/fwalzel/handlebars-i18n-cli.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"cli helper",
|
|
24
|
+
"handlebars-i18n",
|
|
25
|
+
"handlebars",
|
|
26
|
+
"i18n-next",
|
|
27
|
+
"extract translations from i18next templates",
|
|
28
|
+
"handlebars-i18next"
|
|
29
|
+
],
|
|
30
|
+
"author": "Florian Walzel",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/fwalzel/handlebars-i18n-cli/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/fwalzel/handlebars-i18n-cli#readme",
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"esm": "^3.2.25",
|
|
38
|
+
"util": "^0.12.4"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"chai": "^4.3.6",
|
|
42
|
+
"chai-as-promised": "^7.1.1",
|
|
43
|
+
"coveralls": "3.1.1",
|
|
44
|
+
"istanbul": "^0.4.5",
|
|
45
|
+
"mocha": "^10.1.0",
|
|
46
|
+
"nyc": "^15.1.0",
|
|
47
|
+
"test-console": "^2.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|