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 support for basic conditionals in the t helper #320

Merged
merged 1 commit into from
Mar 12, 2021

Conversation

Mikek2252
Copy link
Collaborator

@Mikek2252 Mikek2252 commented Feb 1, 2021

Adding additional parsing to check if the t helper has a conditional and adding the potential options.

Addresses #143

index.js Outdated
translationKeys.add(firstParam.value);
} else if (firstParam.type === 'SubExpression' && firstParam.path.original === 'if') {
let conditionResults = firstParam.params.slice(1);
conditionResults.forEach(conditionResult => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why did you use forEach() here? I'm wondering if it would be easier to understand if we looked at firstParam.params[1] and firstParam.params[2] directly

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah fine with that, just didnt want to repeat myself, but will change if you think it reads better

@Turbo87 Turbo87 added the enhancement New feature or request label Feb 1, 2021
@Mikek2252 Mikek2252 force-pushed the find-translations-in-conditions branch from 264db42 to c302c18 Compare February 1, 2021 14:55
Copy link
Collaborator

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

👍

@Turbo87 Turbo87 changed the title adding check for conditionals in the t helper to find conditional tra… Add support for basic conditionals in the t helper Mar 12, 2021
@Turbo87 Turbo87 merged commit 1574442 into master Mar 12, 2021
@delete-merged-branch delete-merged-branch bot deleted the find-translations-in-conditions branch March 12, 2021 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants