Skip to content

Commit 8e1dbc3

Browse files
committed
Add support for VueJs v-text attributes for i18n strings extract
1 parent c2e5c03 commit 8e1dbc3

13 files changed

Lines changed: 49 additions & 15 deletions

File tree

src/Extractors/VueJs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static function fromString($string, Translations $translations, array $op
2626
':',
2727
'v-bind:',
2828
'v-on:',
29+
'v-text',
2930
],
3031
// HTML Tags to parse
3132
'tagNames' => [

tests/AssetsTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,14 +421,16 @@ public function testTwig()
421421
public function testVueJs()
422422
{
423423
$translations = static::get('vuejs/input', 'VueJs');
424-
$countTranslations = 31;
424+
425+
$countTranslations = 32;
425426
$countTranslated = 0;
426427
$countHeaders = 8;
427428

428429
$this->assertCount($countTranslations, $translations);
429430
$this->assertCount($countHeaders, $translations->getHeaders());
430431
$this->assertEquals(0, $translations->countTranslated());
431432

433+
432434
$this->assertContent($translations, 'vuejs/Po');
433435
$this->assertContent($translations, 'vuejs/Mo');
434436
$this->assertContent($translations, 'vuejs/PhpArray');

tests/assets/vuejs/Csv.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ some-context,js-action,
2121
,t-singular2,
2222
,t-v-bind,
2323
context,t-action,
24+
,t-v-text,
2425
,t-text,
2526
,t-singular,
2627
,t-tag,

tests/assets/vuejs/CsvDictionary.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ multi-occurrence,
1212
t-singular2,
1313
t-v-bind,
1414
t-action,
15+
t-v-text,
1516
t-text,
1617
t-singular,
1718
t-tag,

tests/assets/vuejs/Jed.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
"context\\u0004t-action": [
4848
""
4949
],
50+
"t-v-text": [
51+
""
52+
],
5053
"t-text": [
5154
""
5255
],

tests/assets/vuejs/Json.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
"t-v-bind": [
4343
""
4444
],
45+
"t-v-text": [
46+
""
47+
],
4548
"t-text": [
4649
""
4750
],

tests/assets/vuejs/JsonDictionary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"t-singular2": "",
1414
"t-v-bind": "",
1515
"t-action": "",
16+
"t-v-text": "",
1617
"t-text": "",
1718
"t-singular": "",
1819
"t-tag": "",

tests/assets/vuejs/PhpArray.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@
6565
array (
6666
0 => '',
6767
),
68+
't-v-text' =>
69+
array (
70+
0 => '',
71+
),
6872
't-text' =>
6973
array (
7074
0 => '',

tests/assets/vuejs/Po.po

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,34 @@ msgstr ""
99
"Project-Id-Version: \n"
1010
"Report-Msgid-Bugs-To: \n"
1111

12-
#: ./tests/assets/vuejs/input.vue:49
12+
#: ./tests/assets/vuejs/input.vue:51
1313
msgid "js-expr1"
1414
msgstr ""
1515

16-
#: ./tests/assets/vuejs/input.vue:49
16+
#: ./tests/assets/vuejs/input.vue:51
1717
msgid "js-expr2"
1818
msgstr ""
1919

20-
#: ./tests/assets/vuejs/input.vue:51
20+
#: ./tests/assets/vuejs/input.vue:53
2121
msgid "js-alert"
2222
msgstr ""
2323

24-
#: ./tests/assets/vuejs/input.vue:54
24+
#: ./tests/assets/vuejs/input.vue:56
2525
msgid "js-single"
2626
msgid_plural "js-plural"
2727
msgstr[0] ""
2828

29-
#: ./tests/assets/vuejs/input.vue:58
29+
#: ./tests/assets/vuejs/input.vue:60
3030
msgid "js-obj-single"
3131
msgid_plural "js-obj-plural"
3232
msgstr[0] ""
3333

34-
#: ./tests/assets/vuejs/input.vue:61
34+
#: ./tests/assets/vuejs/input.vue:63
3535
msgctxt "some-context"
3636
msgid "js-action"
3737
msgstr ""
3838

39-
#: ./tests/assets/vuejs/input.vue:63
39+
#: ./tests/assets/vuejs/input.vue:65
4040
msgid "<span>js-return</span><br>"
4141
msgstr ""
4242

@@ -73,6 +73,10 @@ msgctxt "context"
7373
msgid "t-action"
7474
msgstr ""
7575

76+
#: ./tests/assets/vuejs/input.vue:43
77+
msgid "t-v-text"
78+
msgstr ""
79+
7680
#: ./tests/assets/vuejs/input.vue:3
7781
msgid "t-text"
7882
msgstr ""

tests/assets/vuejs/Xliff.xlf

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<unit id="38dbba24eb02d64da6159a778a36d73a">
1515
<notes>
1616
<note category="context"></note>
17-
<note category="reference">./tests/assets/vuejs/input.vue:49</note>
17+
<note category="reference">./tests/assets/vuejs/input.vue:51</note>
1818
</notes>
1919
<segment>
2020
<source>js-expr1</source>
@@ -24,7 +24,7 @@
2424
<unit id="e8955f4e596af6cbcdfb35f22ba26dbd">
2525
<notes>
2626
<note category="context"></note>
27-
<note category="reference">./tests/assets/vuejs/input.vue:49</note>
27+
<note category="reference">./tests/assets/vuejs/input.vue:51</note>
2828
</notes>
2929
<segment>
3030
<source>js-expr2</source>
@@ -34,7 +34,7 @@
3434
<unit id="4819d163f4b26023f7ba7d6a20d8473e">
3535
<notes>
3636
<note category="context"></note>
37-
<note category="reference">./tests/assets/vuejs/input.vue:51</note>
37+
<note category="reference">./tests/assets/vuejs/input.vue:53</note>
3838
</notes>
3939
<segment>
4040
<source>js-alert</source>
@@ -44,7 +44,7 @@
4444
<unit id="8a33b4fd199bcbc69fbdf4c7bce48b90">
4545
<notes>
4646
<note category="context"></note>
47-
<note category="reference">./tests/assets/vuejs/input.vue:54</note>
47+
<note category="reference">./tests/assets/vuejs/input.vue:56</note>
4848
</notes>
4949
<segment>
5050
<source>js-single</source>
@@ -54,7 +54,7 @@
5454
<unit id="b81ee1ffb034bd2cf1ec589349c4d069">
5555
<notes>
5656
<note category="context"></note>
57-
<note category="reference">./tests/assets/vuejs/input.vue:58</note>
57+
<note category="reference">./tests/assets/vuejs/input.vue:60</note>
5858
</notes>
5959
<segment>
6060
<source>js-obj-single</source>
@@ -64,7 +64,7 @@
6464
<unit id="db5923b843960d8cc6e2064bb2d4fbc2">
6565
<notes>
6666
<note category="context">some-context</note>
67-
<note category="reference">./tests/assets/vuejs/input.vue:61</note>
67+
<note category="reference">./tests/assets/vuejs/input.vue:63</note>
6868
</notes>
6969
<segment>
7070
<source>js-action</source>
@@ -74,7 +74,7 @@
7474
<unit id="165738b03fc41d793cf080ad7f3bf5e3">
7575
<notes>
7676
<note category="context"></note>
77-
<note category="reference">./tests/assets/vuejs/input.vue:63</note>
77+
<note category="reference">./tests/assets/vuejs/input.vue:65</note>
7878
</notes>
7979
<segment>
8080
<source><![CDATA[<span>js-return</span><br>]]></source>
@@ -153,6 +153,16 @@
153153
<target></target>
154154
</segment>
155155
</unit>
156+
<unit id="daad8e925a18ba86fb4d313c9f5f6851">
157+
<notes>
158+
<note category="context"></note>
159+
<note category="reference">./tests/assets/vuejs/input.vue:43</note>
160+
</notes>
161+
<segment>
162+
<source>t-v-text</source>
163+
<target></target>
164+
</segment>
165+
</unit>
156166
<unit id="89585a1f45ac926e8807a68a4d9b1ad9">
157167
<notes>
158168
<note category="context"></note>

0 commit comments

Comments
 (0)