Skip to content

Commit dde35c8

Browse files
committed
🆙 update: fix template literal
1 parent 95e5e64 commit dde35c8

File tree

3 files changed

+62
-108
lines changed

3 files changed

+62
-108
lines changed

src/infuser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function buildContent (i18nBlocks: SFCI18nBlock[], raw: string, blocks: SFCBlock
6767
}
6868

6969
contents = contents.concat(raw.slice(offset, block.start))
70-
const serialized = `\n${stringifyContent(messages, lang), lang}`
70+
const serialized = `\n${stringifyContent(messages, lang)}`
7171
contents = contents.concat(serialized)
7272
offset = block.end as number
7373
i18nBlockCounter++
@@ -102,5 +102,5 @@ function buildI18nTag (i18nBlock: SFCI18nBlock): string {
102102

103103
return `\n
104104
${tag}
105-
${stringifyContent(locale ? messages[locale] : messages, lang), lang}</i18n>`
105+
${stringifyContent(locale ? messages[locale] : messages, lang)}</i18n>`
106106
}

test/__snapshots__/infuser.test.ts.snap

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ export default {}
1717
\\"ja\\": {
1818
\\"title\\": \\"アプリケーション\\"
1919
}
20-
}
21-
</i18n>"
20+
}</i18n>"
2221
`;
2322

2423
exports[`json: /path/to/project1/src/components/Modal.vue 1`] = `
@@ -34,15 +33,13 @@ export default {}
3433
{
3534
\\"ok\\": \\"OK\\",
3635
\\"cancel\\": \\"Cancel\\"
37-
}
38-
</i18n>
36+
}</i18n>
3937
4038
<i18n locale=\\"ja\\">
4139
{
4240
\\"ok\\": \\"OK\\",
4341
\\"cancel\\": \\"キャンセル\\"
44-
}
45-
</i18n>"
42+
}</i18n>"
4643
`;
4744
4845
exports[`json: /path/to/project1/src/components/nest/RankingTable.vue 1`] = `
@@ -61,8 +58,7 @@ export default {}
6158
\\"name\\": \\"Name\\",
6259
\\"score\\": \\"Score\\"
6360
}
64-
}
65-
</i18n>
61+
}</i18n>
6662
6763
<i18n locale=\\"ja\\">
6864
{
@@ -71,8 +67,7 @@ export default {}
7167
\\"name\\": \\"名前\\",
7268
\\"score\\": \\"スコア\\"
7369
}
74-
}
75-
</i18n>"
70+
}</i18n>"
7671
`;
7772
7873
exports[`json: /path/to/project1/src/pages/Dashboard1.vue 1`] = `
@@ -91,16 +86,14 @@ export default {
9186
\\"ja\\": {
9287
\\"title\\": \\"ダッシュボード\\"
9388
}
94-
}
95-
</i18n>
89+
}</i18n>
9690
9791
<i18n>
9892
{
9993
\\"ja\\": {
10094
\\"loading\\": \\"読込中...\\"
10195
}
102-
}
103-
</i18n>"
96+
}</i18n>"
10497
`;
10598
10699
exports[`json: /path/to/project1/src/pages/Dashboard2.vue 1`] = `
@@ -117,14 +110,12 @@ export default {
117110
<i18n locale=\\"ja\\">
118111
{
119112
\\"title\\": \\"ダッシュボード\\"
120-
}
121-
</i18n>
113+
}</i18n>
122114
123115
<i18n locale=\\"ja\\">
124116
{
125117
\\"loading\\": \\"読込中...\\"
126-
}
127-
</i18n>"
118+
}</i18n>"
128119
`;
129120
130121
exports[`json: /path/to/project1/src/pages/Login.vue 1`] = `
@@ -144,17 +135,15 @@ export default {}
144135
\\"confirm\\": \\"パスワードの確認入力\\",
145136
\\"button\\": \\"ログイン\\"
146137
}
147-
}
148-
</i18n>
138+
}</i18n>
149139
150140
<i18n locale=\\"en\\">
151141
{
152142
\\"id\\": \\"User ID\\",
153143
\\"password\\": \\"Password\\",
154144
\\"confirm\\": \\"Confirm Password\\",
155145
\\"button\\": \\"Login\\"
156-
}
157-
</i18n>"
146+
}</i18n>"
158147
`;
159148
160149
exports[`json5: /path/to/project1/src/components/Modal.vue 1`] = `
@@ -168,36 +157,32 @@ export default {}
168157
169158
<i18n lang=\\"json5\\" locale=\\"en\\">
170159
{
171-
ok: \\"OK\\",
172-
cancel: \\"Cancel\\"
173-
}
174-
</i18n>
160+
ok: 'OK',
161+
cancel: 'Cancel',
162+
}</i18n>
175163
176164
<i18n locale=\\"ja\\">
177165
{
178166
\\"ok\\": \\"OK\\",
179167
\\"cancel\\": \\"キャンセル\\"
180-
}
181-
</i18n>
168+
}</i18n>
182169
183170
<i18n locale=\\"en\\" lang=\\"json5\\">
184171
{
185-
id: \\"User ID\\",
186-
password: \\"Password\\",
187-
confirm: \\"Confirm Password\\",
188-
button: \\"Login\\"
189-
}
190-
</i18n>
172+
id: 'User ID',
173+
password: 'Password',
174+
confirm: 'Confirm Password',
175+
button: 'Login',
176+
}</i18n>
191177
192178
<i18n locale=\\"ja\\" lang=\\"json5\\">
193179
{
194180
headers: {
195-
rank: \\"ランク\\",
196-
name: \\"名前\\",
197-
score: \\"スコア\\"
198-
}
199-
}
200-
</i18n>"
181+
rank: 'ランク',
182+
name: '名前',
183+
score: 'スコア',
184+
},
185+
}</i18n>"
201186
`;
202187
203188
exports[`not full localitation: /path/to/project1/src/App.vue 1`] = `
@@ -217,8 +202,7 @@ export default {}
217202
\\"ja\\": {
218203
\\"title\\": \\"アプリケーション\\"
219204
}
220-
}
221-
</i18n>"
205+
}</i18n>"
222206
`;
223207
224208
exports[`not full localitation: /path/to/project1/src/components/Modal.vue 1`] = `
@@ -234,25 +218,22 @@ export default {}
234218
{
235219
\\"ok\\": \\"OK\\",
236220
\\"cancel\\": \\"Cancel\\"
237-
}
238-
</i18n>
221+
}</i18n>
239222
240223
<i18n locale=\\"ja\\">
241224
{
242225
\\"ok\\": \\"OK\\",
243226
\\"cancel\\": \\"キャンセル\\"
244-
}
245-
</i18n>
227+
}</i18n>
246228
247229
<i18n locale=\\"ja\\" lang=\\"json5\\">
248230
{
249231
headers: {
250-
rank: \\"ランク\\",
251-
name: \\"名前\\",
252-
score: \\"スコア\\"
253-
}
254-
}
255-
</i18n>"
232+
rank: 'ランク',
233+
name: '名前',
234+
score: 'スコア',
235+
},
236+
}</i18n>"
256237
`;
257238
258239
exports[`not full localitation: /path/to/project1/src/components/nest/RankingTable.vue 1`] = `
@@ -271,8 +252,7 @@ export default {}
271252
\\"name\\": \\"Name\\",
272253
\\"score\\": \\"Score\\"
273254
}
274-
}
275-
</i18n>"
255+
}</i18n>"
276256
`;
277257
278258
exports[`not full localitation: /path/to/project1/src/pages/Dashboard1.vue 1`] = `
@@ -291,16 +271,14 @@ export default {
291271
\\"ja\\": {
292272
\\"title\\": \\"ダッシュボード\\"
293273
}
294-
}
295-
</i18n>
274+
}</i18n>
296275
297276
<i18n>
298277
{
299278
\\"ja\\": {
300279
\\"loading\\": \\"読込中...\\"
301280
}
302-
}
303-
</i18n>"
281+
}</i18n>"
304282
`;
305283
306284
exports[`not full localitation: /path/to/project1/src/pages/Dashboard2.vue 1`] = `
@@ -317,14 +295,12 @@ export default {
317295
<i18n locale=\\"ja\\">
318296
{
319297
\\"title\\": \\"ダッシュボード\\"
320-
}
321-
</i18n>
298+
}</i18n>
322299
323300
<i18n locale=\\"ja\\">
324301
{
325302
\\"loading\\": \\"読込中...\\"
326-
}
327-
</i18n>"
303+
}</i18n>"
328304
`;
329305
330306
exports[`not full localitation: /path/to/project1/src/pages/Login.vue 1`] = `
@@ -344,8 +320,7 @@ export default {}
344320
\\"confirm\\": \\"パスワードの確認入力\\",
345321
\\"button\\": \\"ログイン\\"
346322
}
347-
}
348-
</i18n>"
323+
}</i18n>"
349324
`;
350325
351326
exports[`yaml: /path/to/project1/src/components/Modal.vue 1`] = `

0 commit comments

Comments
 (0)