vue-i18n-extract icon indicating copy to clipboard operation
vue-i18n-extract copied to clipboard

Add support for Pug templates

Open pixari opened this issue 4 years ago • 4 comments

Acceptance Criteria

  • [ ] Pug component templates must be supported
  • [ ] cover new cases with unit test

Info

Consider this solution provided by @gilles-crealp:

function extractComponentMatches(file: SimpleFile): I18NItem[] {
  const componentHtmlRegExp = /(?:<i18n)(?:.|\n)*?(?:[^:]path=("|'))(.*?)\1/gi;
  const componentPugRegExp = /i18n\((?:.|\n)*?(?<!:)path=("|')(.*?)\1/gi;

  return [
    ...getMatches(file, componentHtmlRegExp, 2),
    ...getMatches(file, componentPugRegExp, 2)
  ]
}

pixari avatar Feb 23 '21 08:02 pixari

@gilles-crealp I would be open to a PR for this.

Spittal avatar Sep 01 '21 21:09 Spittal

As I wrote in #101, I'm not sure how to implement the unit test.

gilles-crealp avatar Sep 02 '21 05:09 gilles-crealp

No problem, I unfortunately don't code in pug and therefore don't know the syntax I would be looking out for so I'll leave this to someone who perhaps knows how to write pug.

Spittal avatar Sep 02 '21 15:09 Spittal

@Spittal @pixari Guys, are you going to maintain this package? I found it a very good tool and we use it in our project. There are a lot of features could be added.

Though I see that there are some ready to merge PRs which are pending for quite a long time and new issues are not tracked/reviewed for months. If you are willing to work on the new version, I could write some feature requests in Issues and try to create PRs to resolve some existing. Just let me know if you can review/approve the code and move it forward. Thank you!

P.S. And I used this issue to ping you coz we're using pug and it's support would be awesome and I could try to implement it.

alex-key avatar Feb 25 '23 20:02 alex-key