Skip to content

Conversation

f-aubert
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • [X ] Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: 829

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • [X ] No

Other information

Copy link

pkg-pr-new bot commented Jan 15, 2025

Open in StackBlitz

@jsverse/transloco

npm i https://pkg.pr.new/@jsverse/transloco@832

@jsverse/transloco-locale

npm i https://pkg.pr.new/@jsverse/transloco-locale@832

@jsverse/transloco-messageformat

npm i https://pkg.pr.new/@jsverse/transloco-messageformat@832

@jsverse/transloco-optimize

npm i https://pkg.pr.new/@jsverse/transloco-optimize@832

@jsverse/transloco-persist-lang

npm i https://pkg.pr.new/@jsverse/transloco-persist-lang@832

@jsverse/transloco-persist-translations

npm i https://pkg.pr.new/@jsverse/transloco-persist-translations@832

@jsverse/transloco-preload-langs

npm i https://pkg.pr.new/@jsverse/transloco-preload-langs@832

@jsverse/transloco-scoped-libs

npm i https://pkg.pr.new/@jsverse/transloco-scoped-libs@832

@jsverse/transloco-utils

npm i https://pkg.pr.new/@jsverse/transloco-utils@832

@jsverse/transloco-validator

npm i https://pkg.pr.new/@jsverse/transloco-validator@832

commit: d1439bb

@f-aubert
Copy link
Author

@shaharkazaz ? May I assist you in letting this merged? thxs

@shaharkazaz
Copy link
Collaborator

@f-aubert See my comment

Comment on lines 184 to 187
return func.transpile(...getFunctionArgs(args));
return func.transpile(
...getFunctionArgs(args).map((arg) =>
this.transpile({ value: arg, ...rest }),
),
Copy link
Collaborator

@shaharkazaz shaharkazaz Aug 6, 2025

Choose a reason for hiding this comment

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

The question here do we want to support nested function transpilations? I'm not sure that would actually work.
Add a test case, if that works, cool. otherwise let's skip directly to the parent transpiler

const transpiledArgs = super.transpile({value: getFunctionArgs(args), ...rest});
return func.transpile(...transpiledArgs);

Copy link
Author

Choose a reason for hiding this comment

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

You are right. As far as I can tell, this PR doesn't implements nesting function because getFunctionArgs use a simple pattern to separate the args, namely on comma. A regexp engine with support of nesting would be needed. I sure can look into that, but I could also live with this limitation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's keep it simple

Copy link
Collaborator

Choose a reason for hiding this comment

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

Make the changes and test the pkg-pr-new release

Copy link
Author

Choose a reason for hiding this comment

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

Not exactly sure what do you want me to do / change? I think the original code with the map call should do it... Thks

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please call the super like in the code I suggested

@f-aubert f-aubert force-pushed the transloco-functionaltranspiler branch from 5597e5d to ec8ff1c Compare August 11, 2025 12:49
@f-aubert
Copy link
Author

I pushed what you suggested. I called this.transpile (instead of super.transpile) on the functionArgs. It shouldn't have any impact, but would allow nesting function if we ever improved the parsing in getFunctionArgs (to ignore coma when in a nested context such as [[ or {{).
Git Technic: I did merge your master branch in my transloco-functional-transpiler fork. I hope it suits you, else I can always start again and create a new branch with just one commit with my changes.

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.

2 participants