Skip to content

selfclosing html tags could stop parsing #88

Description

@bussnet

We have some missing strings and I found out that some vue structure leads to stop parsing after that.

We have this issue with a <select/> which has no closed </select>, but is closed in the open tag, but this seems to depend on the structure, because broke down to a simple test, this works.

Otherwise we have the same problem with an Textarea without a closing tag.

test.vue

<input :legend="_i('TRANSLATED')" />
<Textarea id="comment" name="comment" />
<input :legend="_i('NOT WORKING 2')" />

test-extract.mjs

import {GettextExtractor, HtmlExtractors, JsExtractors} from 'gettext-extractor'

const extractor = new GettextExtractor()

const jsParser = extractor.createJsParser([
    JsExtractors.callExpression('_i', {
        arguments: {
            text: 0,
        },
    }),
]);
extractor.createHtmlParser([
    HtmlExtractors.embeddedJs('*', jsParser),
    HtmlExtractors.embeddedAttributeJs(/:[a-z]+/, jsParser),
])
jsParser.parseFile('./test.vue');
extractor.savePotFile('./test.pot')

extracting output

node test-extract.mjs

.pot file

msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"

#: test.vue:1
msgid "TRANSLATED"
msgstr ""

We had such an issue two times, and everytime this is a big examination why there are single words are not translatable (which were sometimtes before) :(.

Any suggestions or idea for fixing this?

... or at least an error output that there is an syntax error and we have to look for missing strings.

best, Thorsten

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions