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

feat: add extraction of enums from markers #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

QuCMGisaia
Copy link

Hello !

This PR aims to allow for the marker extraction to also extract enum members to improve i18n files generation.

Removes the limitation that was in place on the query of CallExpression to allow PropertyAccessExpression. This allows to get markers with Enum. By testing the structure of the Expression, we gather the information relative to the enum member that we are looking for. By browsing the files that contain the enumeration (whether locally or in the imports of the file), we can find the value that the enum member was initialized to. If the value is of type string we keep it in the extracted list.

bastianjoel pushed a commit to bastianjoel/ngx-translate-extract that referenced this pull request Sep 15, 2023
* fix(pipe-parser) search for pipe in structural directives

* refactor(pipe-parser) simplify handling of pipes in getTranslatablesFromAst

remove expressionIsOrHasBindingPipe - previously this also handled cases like `'World' | translate | upper`,
but it's not actually needed, getTranslatablesFromAst can deal with it by itself

move checks for translate and non-translate pipes together under a common BindingPipe check.

* fix(pipe-parser): find usages of translate pipe in arguments of other pipes

* feat(pipe): accommodate marker directive

* feat(pipe): accommodate forks of marker fn

* feat(pipe): accommodate marker pipe

* chore: initial commit after fork

* fix: fixed some botched imports

* chore: editorconfig, refactoring and bump

* chore: fixed some botched imports

* re-add --marker option

    -m or --marker is an old option that was in
    biesbjerg/ngx-translate-extract

    it was removed and replaced by the ngx-extract-translate-marker
    mechanism but this new mechanism does not allow to easily
    customize what the marker function does
    (some users have use cases where this is not a no-op)

* Create node.js.yml

* chore: update changelog, readme and bump version

* chore: busywork in prep for the lib to move back into vendure's fork

---------

Co-authored-by: P4 <[email protected]>
Co-authored-by: Christer Olsen <[email protected]>
Co-authored-by: Thomas Mijieux <[email protected]>
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.

1 participant