Open
Description
Hello! I'm using vue-i18n-extract
in my project.
First of all, thank you for creating such an awesome project!
I discovered that vue-i18n-extract
cannot detect or collect missing keys when using CRLF
end-of-line sequences.
Upon examining the source code, I found that the componentRegExp
inside the extractComponentMatches
function only detects the LF end-of-line sequence.
const componentRegExp = /(?:(?:<|h\()(?:i18n|Translation))(?:.|\n)*?(?:\s(?:(?:key)?)path(?:=|: )("|'))((?:[^\\]|\\.)*?)\1/gi;
I tried the following regex, which successfully detects the CRLF end-of-line sequence.
const componentRegex = /(?:(?:<|h\()(?:i18n|Translation))(?:.|\r?\n|\r)*?(?:[^:]path(?:=|: )("|'))((?:[^\\]|\\.)*?)\1/gi;
Expected behavior
The regex should detect missing keys in the i18n-t
component, even when CRLF
end-of-line sequences are used.
<i18n-t
tag="p"
keypath="The grass is always greener on the other side of the fence from {username}"
class="message"
>
<template #username> {{ username }} </template>
</i18n-t>
Actual behavior
The current regex does not detect or collect missing keys when the i18n-t
component uses CRLF
end-of-line sequences.
Steps to reproduce
- Set
singleAttributePerLine
totrue
in your .prettierrc file. - Change the end-of-line sequence to
CRLF
. - Create an
i18n-t
component with multiple props and attributes. - Run the vue-i18n-extract report.
You can try with this setup with the following sandbox
npm run vue-i18n-extract
Metadata
Metadata
Assignees
Labels
No labels