Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add embeddedAttrJsExtractor #60

Merged
merged 14 commits into from
Mar 13, 2023
Merged

Conversation

youthlin
Copy link
Contributor

@youthlin youthlin commented Feb 9, 2023

Hello, I want to extract message from element's attribute like this:

<template>
  <span :title="_xn('title', '%{n} apple', '%{n} apples', n, {n:''+n})">
    see my title
  </span>
</template>

I found the code from https://github.com/jshmrtn/vue3-gettext/blob/master/scripts/attributeEmbeddedJsExtractor.ts
I think it would be better implement by this repo, so that it can be relied upon and used by more repositories

Copy link
Owner

@lukasgeiter lukasgeiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!

In addition to the comments I've left in the code, I would really like to see some tests specifically for the new extractor. Take a look at the existing tests for embeddedJs for some inspiration.

tests/e2e/fixtures/html/linenumberStart.html Outdated Show resolved Hide resolved
src/html/extractors/factories/embeddedAttrJs.ts Outdated Show resolved Hide resolved
src/html/extractors/factories/elementAttribute.ts Outdated Show resolved Hide resolved
src/html/extractors/factories/embeddedAttrJs.ts Outdated Show resolved Hide resolved
src/html/extractors/factories/embeddedAttrJs.ts Outdated Show resolved Hide resolved
src/html/extractors/factories/embeddedAttrJs.ts Outdated Show resolved Hide resolved
tests/e2e/html.test.ts Outdated Show resolved Hide resolved
@lukasgeiter lukasgeiter merged commit 4276367 into lukasgeiter:master Mar 13, 2023
@youthlin youthlin deleted the patch-2 branch March 13, 2023 11:25
@lukasgeiter
Copy link
Owner

Released with v3.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants