Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A nested
plural()in a hook-boundttemplate can become two messages instead of one. This reproduces with native-tools 0.1.6, the latest release 0.2.0, and current main.wrapcan bememo,forwardRef, or an arbitrary function. A standalone function expression and an object method also reproduce it. A plain function declaration, an unwrapped arrow, and an imported coretkeep the message intact.Babel and CLI extraction produce one message,
Selected {count, plural, one {# item} other {# items}}, with IDoDeoLE. The native transform instead emitsSelected {0}with IDpEM-Myaround a separately translated plural with IDMd_eZS. A catalog containing the extracted translation cannot satisfy those lookups. I verified English fallback text with full descriptors and the raw IDpEM-Mywith production ID-only descriptors.LinguiMacroFolderenters hook scopes, but its recursiveJsMacroFoldercan reach a function through an enclosing expression first. It compilesplural()before the hook'stbinding is registered. Move the existing hook and function-entry handling intoJsMacroFolder, so function entry happens before its expressions are transformed regardless of how traversal reaches the function. Keep the outer folder's function-declaration entry point and remove the arrow-only special case.Eight snapshot tests cover the failing forms, nested hook scopes, and controls for an outer hook translator and an imported core translator. All existing snapshots stay unchanged. Against unmodified main, six new tests fail and the two controls pass. With the fix, all eight pass.
Validation:
cargo test --workspace: 338 tests passed.cargo fmt --all --check: passed.cargo clippy --all-targets --all-features -- -D warnings: passed.cargo build -p lingui_native_tools: passed.vitest run --config vitest.config.tsinpackages/native-tools, using the locally built native library: 43 tests passed.oDeoLEand displays its translation with both full and ID-only descriptors.The WASM package's JavaScript e2e suite and release build were not run. The shared Rust transform is covered by the workspace tests and the native binding tests above.
AI assistance: this change and its regression tests were developed and validated with OpenAI Codex.