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
Extract parameter type translations #59
Conversation
JSXAttribute(path) { | ||
const { node } = path; | ||
|
||
if (hasStringLiteralJSXAttribute(path) && !isSvgElementAttribute(path)) { | ||
addPhrase(node.value.value); | ||
} | ||
}, | ||
JSXElement(path) { | ||
const { node } = path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better extract this logic to a function to make it clear
src/BabelPluginI18n.ts
Outdated
textWithoutArgs += element.value; | ||
} | ||
if (element.type === 'JSXExpressionContainer') { | ||
textWithArgs += `{arg${argIndex}}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can try to improve naming of args
const jsxContentNodes = n.value.children; | ||
let text = ''; | ||
let translateArgs = []; | ||
let newChildren = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better move to a separate function
there are some tests failing Test Suites: 3 failed, 3 passed, 6 total we should setup CI for this as well |
Will add resources extraction into same PR and improve overall quality, but see if you like the overall approach